Change the profile concept to presets.
authorSalvatore Iovene <salvatore@iovene.com>
Sun, 20 Dec 2009 18:41:32 +0000 (20:41 +0200)
committerSalvatore Iovene <salvatore@iovene.com>
Sun, 20 Dec 2009 18:41:32 +0000 (20:41 +0200)
configure.ac
debian/tweakr.install
modules/Makefile.am
modules/data/91.tweakr.ini [deleted file]
modules/data/tweakr-profile-widget.desktop [new file with mode: 0644]
modules/tweakr-profile-status-menu-widget.c [new file with mode: 0644]
modules/tweakr-profile.c

index ddacac5..56adfb9 100644 (file)
@@ -44,6 +44,12 @@ PKG_CHECK_MODULES(PROFILE, profile >= 0.0.16)
 AC_SUBST(PROFILE_LIBS)
 AC_SUBST(PROFILE_CFLAGS)
 
+PKG_CHECK_MODULES(HILDON_DESKTOP, libhildondesktop-1)
+AC_SUBST(HILDON_DESKTOP_LIBS)
+AC_SUBST(HILDON_DESKTOP_CFLAGS)
+
+CFLAGS="-g -O0 -Wall -Werror"
+
 AC_ARG_ENABLE(cast-checks,  [  --disable-cast-checks   compile with GLIB cast checks disabled],[cchecks=${enableval}],cchecks=yes)
 if test "x$cchecks" = "xno"; then
     CFLAGS="$CFLAGS -DG_DISABLE_CAST_CHECKS"
index 44706e5..534303e 100644 (file)
@@ -1,8 +1,9 @@
 usr/lib/hildon-control-panel/*.so*
+usr/lib/hildon-desktop/*.so*
 usr/lib/libtweakr-section.so*
 usr/share/applications/hildon-control-panel/*.desktop
+usr/share/applications/hildon-status-menu/*.desktop
 usr/share/locale/*/LC_MESSAGES/*
 usr/share/icons/hicolor/48x48/hildon/control_tweakr.png
 usr/lib/tweakr/modules/*.so*
 usr/bin/*
-/etc/profiled/*
index 6b0772c..33a46db 100644 (file)
@@ -7,6 +7,7 @@ AM_CPPFLAGS = \
        $(HILDON_CFLAGS)        \
        $(GCONF2_CFLAGS)        \
        $(PROFILE_CFLAGS)       \
+       $(HILDON_DESKTOP_CFLAGS)        \
        -DTRANSITIONS=\"/usr/share/hildon-desktop/transitions.ini\"     \
        -DMCE=\"/etc/mce/mce.ini\"
 
@@ -52,8 +53,21 @@ tweakr_mce_save_SOURCES = tweakr-mce-save.c
 tweakr_mce_save_LDADD = \
        $(GLIB_LIBS)
 
-tweakr_profile_datadir = /etc/profiled
-tweakr_profile_data_DATA = data/91.tweakr.ini
+statusmenudir = $(libdir)/hildon-desktop
+statusmenu_LTLIBRARIES = \
+       libtweakr-profile-status-menu-widget.la
 
-EXTRA_DIST = $(tweakr_profile_data_DATA)
+libtweakr_profile_status_menu_widget_la_SOURCES = \
+       tweakr-profile-status-menu-widget.c
+libtweakr_profile_status_menu_widget_la_LDFLAGS = -avoid-version -module
+libtweakr_profile_status_menu_widget_la_LIBADD = \
+       $(GTK_LIBS)     \
+       $(HILDON_LIBS)  \
+       $(HILDON_DESKTOP_LIBS)  \
+       $(PROFILE_LIBS)
+
+tweakr_profile_desktopdir = $(prefix)/share/applications/hildon-status-menu
+tweakr_profile_desktop_DATA = data/tweakr-profile-widget.desktop
+
+EXTRADIST = $(tweakr_profile_desktop_DATA)
 
diff --git a/modules/data/91.tweakr.ini b/modules/data/91.tweakr.ini
deleted file mode 100644 (file)
index c223b51..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-[datatype]
-
-ringing.alert.tone           = SOUNDFILE
-ringing.alert.type           = STRING "Ringing" "Silent"
-ringing.alert.volume         = INTEGER 0-100
-
-vibrating.alert.enabled      = BOOLEAN
-
-sms.alert.tone               = SOUNDFILE
-sms.alert.volume             = INTEGER 0-100
-
-im.alert.tone                = SOUNDFILE
-im.alert.volume              = INTEGER 0-100
-
-email.alert.tone             = SOUNDFILE
-email.alert.volume           = INTEGER 0-100
-
-keypad.sound.level           = INTEGER 0-2
-system.sound.level           = INTEGER 0-2
-touchscreen.sound.level      = INTEGER 0-2
-
-clock.alarm.enabled          = BOOLEAN
-calendar.alarm.enabled       = BOOLEAN
-
-[fallback]
-
-ringing.alert.tone           = Nokia_tune.aac
-ringing.alert.type           = ringing
-ringing.alert.volume         = 75
-
-vibrating.alert.enabled      = On
-
-sms.alert.tone               = Message1.aac
-sms.alert.volume             = 60
-
-im.alert.tone                = Message1.aac
-im.alert.volume              = 60
-
-email.alert.tone             = Email1.aac
-email.alert.volume           = 60
-
-keypad.sound.level           = 0
-system.sound.level           = 1
-touchscreen.sound.level      = 1
-
-clock.alarm.enabled          = On
-calendar.alarm.enabled       = On
-
-[Meeting]
-
-ringing.alert.type           = silent
-ringing.alert.volume         = 0
-
-vibrating.alert.enabled      = on
-
-sms.alert.volume             = 0
-im.alert.volume              = 0
-email.alert.volume           = 0
-
-keypad.sound.level           = 0
-system.sound.level           = 0
-touchscreen.sound.level      = 0
-
-calendar.alarm.enabled       = Off
-
-[Night]
-
-ringing.alert.type           = ringing
-ringing.alert.volume         = 20
-
-vibrating.alert.enabled      = off
-
-sms.alert.volume             = 20
-im.alert.volume              = 0
-email.alert.volume           = 0
-
-keypad.sound.level           = 0
-system.sound.level           = 0
-touchscreen.sound.level      = 0
-
-calendar.alarm.enabled       = Off
diff --git a/modules/data/tweakr-profile-widget.desktop b/modules/data/tweakr-profile-widget.desktop
new file mode 100644 (file)
index 0000000..a82f5d6
--- /dev/null
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=0.0.11
+Type=default
+Name=Tweakr Profile presets
+X-Path=libtweakr-profile-status-menu-widget.so
+
diff --git a/modules/tweakr-profile-status-menu-widget.c b/modules/tweakr-profile-status-menu-widget.c
new file mode 100644 (file)
index 0000000..7d2e7a8
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ * vim:ts=4:sw=4:et:cindent:cino=(0
+ */ 
+
+#include <config.h>
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+
+#include <gtk/gtk.h>
+#include <hildon/hildon.h>
+#include <hildon/hildon-button.h>
+#include <hildon/hildon-pannable-area.h>
+#include <libhildondesktop/libhildondesktop.h>
+
+#include <gconf/gconf-client.h>
+
+#include <libprofile.h>
+
+#define TYPE_TWEAKR_PROFILE_STATUS_PLUGIN \
+        (tweakr_profile_status_plugin_get_type ())
+#define TWEAKR_PROFILE_STATUS_PLUGIN(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+        TYPE_TWEAKR_PROFILE_STATUS_PLUGIN, \
+        TweakrProfileStatusPlugin))
+#define TWEAKR_PROFILE_STATUS_PLUGIN_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST ((klass), \
+        TYPE_TWEAKR_PROFILE_STATUS_PLUGIN, \
+        TweakrProfileStatusPluginClass))
+#define IS_TWEAKR_PROFILE_STATUS_PLUGIN(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+        TYPE_TWEAKR_PROFILE_STATUS_PLUGIN))
+#define IS_TWEAKR_PROFILE_STATUS_PLUGIN_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+        TYPE_TWEAKR_PROFILE_STATUS_PLUGIN))
+#define TWEAKR_PROFILE_STATUS_PLUGIN_GET_CLASS(obj) \
+        (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+        TYPE_TWEAKR_PROFILE_STATUS_PLUGIN, \
+        TweakrProfileStatusPluginClass))
+
+typedef struct _TweakrProfileStatusPlugin        TweakrProfileStatusPlugin;
+typedef struct _TweakrProfileStatusPluginClass
+               TweakrProfileStatusPluginClass;
+typedef struct _TweakrProfileStatusPluginPrivate
+               TweakrProfileStatusPluginPrivate; 
+
+struct _TweakrProfileStatusPlugin
+{
+    HDStatusMenuItem parent;
+
+    TweakrProfileStatusPluginPrivate *priv;
+};
+
+struct _TweakrProfileStatusPluginClass
+{
+    HDStatusMenuItemClass parent;
+};
+
+GType tweakr_profile_status_plugin_get_type (void);
+
+#define TWEAKR_PROFILE_STATUS_PLUGIN_GET_PRIVATE(obj) \
+        (G_TYPE_INSTANCE_GET_PRIVATE (obj, \
+        TYPE_TWEAKR_PROFILE_STATUS_PLUGIN, \
+        TweakrProfileStatusPluginPrivate))
+
+#define GCONF_PATH "/system/tweakr"
+
+struct _TweakrProfileStatusPluginPrivate
+{
+    GtkWidget *button;
+    GtkWidget *dialog;
+    GtkWidget *box;
+    GConfClient *gconf;
+};
+
+HD_DEFINE_PLUGIN_MODULE (TweakrProfileStatusPlugin,
+                         tweakr_profile_status_plugin,
+                         HD_TYPE_STATUS_MENU_ITEM);
+
+static void
+_process_entry (GConfEntry *entry, TweakrProfileStatusPlugin *plugin)
+{
+    gchar *basename;
+
+    basename = g_path_get_basename (entry->key);
+
+    profile_set_value ("general", basename,
+                         gconf_value_get_string (entry->value));
+
+    g_free (basename);
+    gconf_entry_free (entry);
+}
+
+static void
+_preset_clicked (HildonButton *button, TweakrProfileStatusPlugin *plugin)
+{
+    GSList *entries;
+    const gchar *path = g_object_get_data (G_OBJECT (button), "path");
+    gchar *basename;
+
+    entries = gconf_client_all_entries (plugin->priv->gconf, path, NULL);
+
+    g_slist_foreach (entries, (GFunc) _process_entry, plugin);
+    g_slist_free (entries);
+
+    profile_set_profile ("general");
+
+    basename = g_path_get_basename (path);
+    hildon_button_set_value (HILDON_BUTTON (plugin->priv->button), basename);
+    gconf_client_set_string (plugin->priv->gconf,
+                             "/system/tweakr/current-preset", basename, NULL);
+    g_free (basename);
+
+    gtk_dialog_response (GTK_DIALOG (plugin->priv->dialog), GTK_RESPONSE_OK);
+    hildon_banner_show_information (NULL, NULL,
+                                    _("Preset activated."));
+}
+
+static void
+_add_preset (gchar *preset, TweakrProfileStatusPlugin *plugin)
+{
+    GtkWidget *button;
+    gchar *basename;
+
+    basename = g_path_get_basename (preset);
+    button = hildon_button_new_with_text
+        (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+         basename, NULL);
+    gtk_button_set_alignment (GTK_BUTTON (button), 0.0f, 0.5f);
+    gtk_box_pack_start (GTK_BOX (plugin->priv->box), button, FALSE, FALSE, 0);
+    g_object_set_data_full (G_OBJECT (button), "path", preset,
+                            (GDestroyNotify) g_free);
+    g_signal_connect (button, "clicked", G_CALLBACK (_preset_clicked),
+                      plugin);
+}
+
+static void
+_button_clicked (HildonButton *b, TweakrProfileStatusPlugin *plugin)
+{
+    GtkWidget *panarea;
+    gint ret;
+    GSList *presets;
+    GtkWidget *parent;
+
+    parent = gtk_widget_get_ancestor (GTK_WIDGET (b), GTK_TYPE_WINDOW);
+    gtk_widget_hide (parent);
+
+    plugin->priv->dialog = gtk_dialog_new ();
+    gtk_window_set_modal (GTK_WINDOW (plugin->priv->dialog), TRUE);
+    gtk_window_set_title (GTK_WINDOW (plugin->priv->dialog),
+                          _("Select preset"));
+
+    panarea = hildon_pannable_area_new ();
+    plugin->priv->box = gtk_vbox_new (FALSE, 0);
+
+    hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA (panarea),
+                                            plugin->priv->box);
+    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (plugin->priv->dialog)->vbox),
+                        panarea, TRUE, TRUE, 0);
+
+    presets = gconf_client_all_dirs (plugin->priv->gconf, GCONF_PATH, NULL);
+
+    g_object_set (G_OBJECT (panarea), "height-request",
+                  MIN (350, g_slist_length (presets) * 70), NULL);
+
+    g_slist_foreach (presets, (GFunc) _add_preset, plugin);
+
+    gtk_widget_show_all (GTK_DIALOG (plugin->priv->dialog)->vbox);
+    ret = gtk_dialog_run (GTK_DIALOG (plugin->priv->dialog));
+    gtk_widget_destroy (plugin->priv->dialog);
+
+    g_slist_free (presets);
+}
+
+static void
+tweakr_profile_status_plugin_class_finalize
+    (TweakrProfileStatusPluginClass *klass)
+{
+}
+
+static void
+tweakr_profile_status_plugin_dispose (GObject *obj)
+{
+    TweakrProfileStatusPlugin *plugin = TWEAKR_PROFILE_STATUS_PLUGIN (obj);
+
+    if (plugin->priv->gconf != NULL)
+    {
+        g_object_unref (plugin->priv->gconf);
+        plugin->priv->gconf = NULL;
+    }
+
+    G_OBJECT_CLASS (tweakr_profile_status_plugin_parent_class)->dispose (obj);
+}
+
+static void
+tweakr_profile_status_plugin_class_init
+    (TweakrProfileStatusPluginClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    object_class->dispose = tweakr_profile_status_plugin_dispose;
+
+    g_type_class_add_private (klass,
+                              sizeof (TweakrProfileStatusPluginPrivate));
+}
+
+static void
+tweakr_profile_status_plugin_init (TweakrProfileStatusPlugin *plugin)
+{
+    gchar *current;
+    GtkWidget *image;
+
+    plugin->priv = TWEAKR_PROFILE_STATUS_PLUGIN_GET_PRIVATE (plugin);
+
+    plugin->priv->gconf = gconf_client_get_default ();
+    plugin->priv->button = hildon_button_new
+        (HILDON_SIZE_AUTO | HILDON_SIZE_FINGER_HEIGHT,
+         HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+    hildon_button_set_title (HILDON_BUTTON (plugin->priv->button),
+                             _("Tweakr profile preset"));
+
+    current = gconf_client_get_string (plugin->priv->gconf,
+                                       "/system/tweakr/current-preset",
+                                       NULL);
+    hildon_button_set_value (HILDON_BUTTON (plugin->priv->button), current);
+    g_free (current);
+    gtk_button_set_alignment (GTK_BUTTON (plugin->priv->button), 0.0f, 0.5f);
+
+    image = gtk_image_new_from_icon_name ("control_tweakr",
+                                          GTK_ICON_SIZE_BUTTON);
+    hildon_button_set_image (HILDON_BUTTON (plugin->priv->button), image);
+
+    g_signal_connect (G_OBJECT (plugin->priv->button), "clicked",
+                      G_CALLBACK (_button_clicked), plugin);
+
+    gtk_container_add (GTK_CONTAINER (plugin), plugin->priv->button);
+    gtk_widget_show_all (plugin->priv->button);
+
+    gtk_widget_show (GTK_WIDGET (plugin));
+}
+
index 61e5d60..26b524d 100644 (file)
@@ -35,6 +35,8 @@
         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
         TWEAKR_TYPE_PROFILE_SECTION))
 
+#define GCONF_PATH "/system/tweakr"
+
 typedef struct _TweakrProfileSection TweakrProfileSection;
 typedef struct _TweakrProfileSectionClass
                TweakrProfileSectionClass;
@@ -43,10 +45,7 @@ struct _TweakrProfileSection
 {
     TweakrSection parent_instance;
 
-    GtkWidget *profile_button;
-    GHashTable *profile_map;
-    guint value_changed : 1;
-    gint previous_selected;
+    GtkWidget *preset_button;
 };
 
 struct _TweakrProfileSectionClass
@@ -126,131 +125,95 @@ tweakr_profile_section_class_init
 }
 
 static void
-_value_changed (HildonPickerButton *button, TweakrProfileSection *section)
+_save_preset_clicked (HildonPickerButton *button,
+                      TweakrProfileSection *section)
 {
-    HildonTouchSelector *selector;
-    gint active;
     GtkWindow *parent;
-
-    selector = hildon_picker_button_get_selector (button);
-    active = hildon_touch_selector_get_active (selector, 0);
+    GtkWidget *dialog, *entry;
+    const gchar* text = NULL;
 
     parent = GTK_WINDOW (gtk_widget_get_ancestor (tweakr_section_get_widget
                                                   (TWEAKR_SECTION (section)),
                                                   GTK_TYPE_WINDOW));
-#if 0
-    if (active == 0)
+    dialog = gtk_dialog_new_with_buttons
+        (_("Save current profile with new name"),
+         parent,
+         GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
+         GTK_STOCK_OK, GTK_RESPONSE_OK,
+         NULL);
+
+    entry = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT);
+    gtk_widget_show (entry);
+
+    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry,
+                        TRUE, TRUE, 0);
+    while (text == NULL || text [0] == '\0')
     {
-        GtkWidget *dialog, *entry;
         gint ret;
-        const gchar *text = NULL;
-
-        dialog = gtk_dialog_new_with_buttons
-            (_("Save current profile with new name"),
-             parent,
-             GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
-             GTK_STOCK_OK, GTK_RESPONSE_OK,
-             NULL);
-
-        entry = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT);
-        gtk_widget_show (entry);
 
-        gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry,
-                            TRUE, TRUE, 0);
-        while (text == NULL || text [0] == '\0')
+        ret = gtk_dialog_run (GTK_DIALOG (dialog));
+        if (ret == GTK_RESPONSE_OK)
         {
-            GtkTreeModel *model;
-            gint index;
+            GtkWidget *banner;
+            profileval_t *values, *values_iter;
+            GConfClient *gconf;
 
-            ret = gtk_dialog_run (GTK_DIALOG (dialog));
-            if (ret == GTK_RESPONSE_OK)
+            text = hildon_entry_get_text (HILDON_ENTRY (entry));
+            if (text == NULL || text[0] == '\0')
             {
-                text = hildon_entry_get_text (HILDON_ENTRY (entry));
-                if (text == NULL || text[0] == '\0')
-                {
-                    GtkWidget *banner;
+                GtkWidget *banner;
 
-                    banner = hildon_banner_show_information
-                        (dialog, NULL, _("Enter the name first."));
+                banner = hildon_banner_show_information
+                    (dialog, NULL, _("Enter the name first."));
 
-                    continue;
-                }
-
-                hildon_touch_selector_append_text (selector, text);
-                model = hildon_touch_selector_get_model (selector, 0);
-                index = gtk_tree_model_iter_n_children (model, NULL);
-                hildon_touch_selector_set_active (selector, 0, index);
+                continue;
             }
-            else
+
+            /* Save the settings to our own gconf directory. */
+
+            gconf = gconf_client_get_default ();
+            values = profile_get_values ("general");
+            for (values_iter = values;
+                 values_iter->pv_key != NULL;
+                 values_iter++)
             {
-                gtk_widget_destroy (dialog);
-                hildon_touch_selector_set_active (selector, 0,
-                                                  section->previous_selected);
-                break;
+                gchar key[128];
+
+                g_snprintf (key, 128, "%s/%s/%s", GCONF_PATH, text,
+                            values_iter->pv_key);
+                gconf_client_set_string (gconf, key, values_iter->pv_val,
+                                         NULL);
             }
+            profile_free_values (values);
+            g_object_unref (gconf);
+
+            banner = hildon_banner_show_information
+                (GTK_WIDGET (parent), NULL,
+                 _("Preset saved. Use the status menu to select it."));
+        }
+        else
+        {
             gtk_widget_destroy (dialog);
+            break;
         }
+        gtk_widget_destroy (dialog);
     }
-#endif
-    section->previous_selected = hildon_touch_selector_get_active (selector,
-                                                                   0);
-    section->value_changed = TRUE;
 }
 
 static GtkWidget *
-_build_profile_select_button (TweakrProfileSection *section)
+_build_save_preset_button (TweakrProfileSection *section)
 {
-    GtkWidget *button, *selector;
-    char **profiles;
-    gint i;
-    char *current_profile;
-
-    selector = hildon_touch_selector_new_text ();
-    /*
-    hildon_touch_selector_append_text
-        (HILDON_TOUCH_SELECTOR (selector),
-         _("Save current profile with new name"));
-    */
-
-    profiles = profile_get_profiles ();
-    for (i = 0; profiles && profiles[i] && profiles[i] != '\0'; i++)
-    {
-        /*
-         * Gotta make some l10n substitution here.
-         */
-        const gchar *p = profiles[i];
-
-        hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),
-                                           _(p));
-        g_hash_table_insert (section->profile_map,
-                             GINT_TO_POINTER (i /*+ 1*/), g_strdup (p));
-
-    }
+    GtkWidget *button;
 
-    current_profile = profile_get_profile ();
-    for (i = 0; profiles[i] && profiles[i] != '\0'; i++)
-    {
-        if (g_strcmp0 (profiles[i], current_profile) == 0)
-        {
-            hildon_touch_selector_set_active
-                (HILDON_TOUCH_SELECTOR (selector), 0, i/* + 1*/);
-            section->previous_selected = i/* + 1*/;
-        }
-    }
-    g_free (current_profile);
-    profile_free_profiles (profiles);
-
-    button = hildon_picker_button_new (HILDON_SIZE_AUTO |
-                                       HILDON_SIZE_FINGER_HEIGHT,
-                                       HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+    button = hildon_button_new (HILDON_SIZE_AUTO |
+                                HILDON_SIZE_FINGER_HEIGHT,
+                                HILDON_BUTTON_ARRANGEMENT_VERTICAL);
     hildon_button_set_title (HILDON_BUTTON (button),
-                             _("Use custom profile"));
+                             _("Save current General profile to new preset"));
     gtk_button_set_alignment (GTK_BUTTON (button), 0.0f, 0.5f);
-    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);
+    g_signal_connect (G_OBJECT (button), "clicked",
+                      G_CALLBACK (_save_preset_clicked), section);
 
     gtk_widget_show (button);
     return button;
@@ -265,50 +228,20 @@ tweakr_profile_section_init (TweakrProfileSection *section)
     iface->name = _("Profiles");
     iface->widget = gtk_vbox_new (FALSE, 0);
 
-    section->profile_map = g_hash_table_new_full (g_direct_hash,
-                                                  g_direct_equal,
-                                                  NULL, g_free);
-    section->profile_button = _build_profile_select_button (section);
+    section->preset_button = _build_save_preset_button (section);
 
-    gtk_box_pack_start (GTK_BOX (iface->widget), section->profile_button,
+    gtk_box_pack_start (GTK_BOX (iface->widget), section->preset_button,
                         FALSE, FALSE, 0);
 }
 
 static void
 tweakr_profile_section_dispose (GObject *obj)
 {
-    TweakrProfileSection *section = TWEAKR_PROFILE_SECTION (obj);
-
-    if (section->profile_map)
-    {
-        g_hash_table_destroy (section->profile_map);
-        section->profile_map = NULL;
-    }
-
     G_OBJECT_CLASS (tweakr_profile_section_parent_class)->dispose (obj);
 }
 
 static gboolean _save (TweakrSection *section, gboolean *requires_restart)
 {
-    if (TWEAKR_PROFILE_SECTION (section)->value_changed)
-    {
-        gint active;
-        const gchar *profile;
-
-        active =
-            hildon_picker_button_get_active (HILDON_PICKER_BUTTON
-                                             (TWEAKR_PROFILE_SECTION
-                                              (section)->profile_button));
-        profile = g_hash_table_lookup
-            (TWEAKR_PROFILE_SECTION (section)->profile_map,
-             GINT_TO_POINTER (active));
-
-        if (profile != NULL && profile[0] != '\0')
-        {
-            profile_set_profile (profile);
-        }
-    }
-
     return TRUE;
 }