#include <hildon/hildon-entry.h>
#include <hildon/hildon-pannable-area.h>
#include <hildon/hildon-defines.h>
+
#include <gconf/gconf-client.h>
+#include <libprofile.h>
+
#include "libtweakr-section/tweakr-section.h"
#include "libtweakr-section/tweakr-module.h"
struct _TweakrProfileSection
{
TweakrSection parent_instance;
+
+ GtkWidget *profile_button;
};
struct _TweakrProfileSectionClass
object_class->dispose = tweakr_profile_section_dispose;
}
+static GtkWidget *
+_build_profile_select_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];
+
+ if (strcmp (p, "general") == 0)
+ {
+ p = _("General");
+ }
+ else if (strcmp (p, "silent") == 0)
+ {
+ p = _("Silent");
+ }
+
+ hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),
+ p);
+ }
+
+ 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);
+ }
+ }
+ g_free (current_profile);
+ profile_free_profiles (profiles);
+
+ button = hildon_picker_button_new (HILDON_SIZE_AUTO |
+ HILDON_SIZE_FINGER_HEIGHT,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+ hildon_button_set_title (HILDON_BUTTON (button),
+ _("Use custom profile"));
+ gtk_button_set_alignment (GTK_BUTTON (button), 0.0f, 0.5f);
+ hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
+ HILDON_TOUCH_SELECTOR (selector));
+
+ gtk_widget_show (button);
+ return button;
+}
+
static void
tweakr_profile_section_init (TweakrProfileSection *section)
{
iface = TWEAKR_SECTION (section);
iface->name = _("Profile");
+ iface->widget = gtk_vbox_new (FALSE, 0);
+
+ section->profile_button = _build_profile_select_button (section);
+
+ gtk_box_pack_start (GTK_BOX (iface->widget), section->profile_button,
+ FALSE, FALSE, 0);
}
static void