--- /dev/null
+[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
#include <gtk/gtk.h>
#include <hildon/hildon-picker-button.h>
#include <hildon/hildon-touch-selector.h>
-#include <hildon/hildon-button.h>
#include <hildon/hildon-entry.h>
-#include <hildon/hildon-pannable-area.h>
#include <hildon/hildon-defines.h>
+#include <hildon/hildon-banner.h>
#include <gconf/gconf-client.h>
TweakrSection parent_instance;
GtkWidget *profile_button;
+ GHashTable *profile_map;
+ guint value_changed : 1;
+ gint previous_selected;
};
struct _TweakrProfileSectionClass
object_class->dispose = tweakr_profile_section_dispose;
}
+static void
+_value_changed (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);
+
+ parent = GTK_WINDOW (gtk_widget_get_ancestor (tweakr_section_get_widget
+ (TWEAKR_SECTION (section)),
+ GTK_TYPE_WINDOW));
+#if 0
+ if (active == 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')
+ {
+ GtkTreeModel *model;
+ gint index;
+
+ 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')
+ {
+ GtkWidget *banner;
+
+ 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);
+ }
+ else
+ {
+ gtk_widget_destroy (dialog);
+ hildon_touch_selector_set_active (selector, 0,
+ section->previous_selected);
+ 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)
{
char *current_profile;
selector = hildon_touch_selector_new_text ();
+ /*
hildon_touch_selector_append_text
(HILDON_TOUCH_SELECTOR (selector),
- _("Save current profile with new name..."));
+ _("Save current profile with new name"));
+ */
profiles = profile_get_profiles ();
for (i = 0; profiles && profiles[i] && profiles[i] != '\0'; i++)
*/
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);
+ _(p));
+ g_hash_table_insert (section->profile_map,
+ GINT_TO_POINTER (i /*+ 1*/), g_strdup (p));
+
}
current_profile = profile_get_profile ();
if (g_strcmp0 (profiles[i], current_profile) == 0)
{
hildon_touch_selector_set_active
- (HILDON_TOUCH_SELECTOR (selector), 0, i + 1);
+ (HILDON_TOUCH_SELECTOR (selector), 0, i/* + 1*/);
+ section->previous_selected = i/* + 1*/;
}
}
g_free (current_profile);
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;
}
TweakrSection *iface;
iface = TWEAKR_SECTION (section);
- iface->name = _("Profile");
+ 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);
gtk_box_pack_start (GTK_BOX (iface->widget), section->profile_button,
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;
}