Commit 46e13997 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

[slideshow] save the delay in milliseconds

parent f887a13c
......@@ -50,13 +50,13 @@ gth_browser_activate_action_view_slideshow (GtkAction *action,
location = gth_browser_get_location_data (browser);
if (g_file_info_get_attribute_status (location->info, "slideshow::personalize") == G_FILE_ATTRIBUTE_STATUS_SET) {
gth_slideshow_set_delay (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_int32 (location->info, "slideshow::delay") / 10.0);
gth_slideshow_set_delay (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_int32 (location->info, "slideshow::delay"));
gth_slideshow_set_automatic (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_boolean (location->info, "slideshow::auto"));
gth_slideshow_set_loop (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_boolean (location->info, "slideshow::loop"));
transition_id = g_strdup (g_file_info_get_attribute_string (location->info, "slideshow::transition"));
}
else {
gth_slideshow_set_delay (GTH_SLIDESHOW (slideshow), eel_gconf_get_float (PREF_SLIDESHOW_CHANGE_DELAY, 5) * 1000);
gth_slideshow_set_delay (GTH_SLIDESHOW (slideshow), (guint) (1000.0 * eel_gconf_get_float (PREF_SLIDESHOW_CHANGE_DELAY, 5.0)));
gth_slideshow_set_automatic (GTH_SLIDESHOW (slideshow), eel_gconf_get_boolean (PREF_SLIDESHOW_AUTOMATIC, TRUE));
gth_slideshow_set_loop (GTH_SLIDESHOW (slideshow), eel_gconf_get_boolean (PREF_SLIDESHOW_WRAP_AROUND, FALSE));
transition_id = eel_gconf_get_string (PREF_SLIDESHOW_TRANSITION, DEFAULT_TRANSITION);
......
......@@ -153,9 +153,9 @@ ss__gth_catalog_read_metadata (GthCatalog *catalog,
"slideshow::loop",
g_file_info_get_attribute_boolean (file_data->info, "slideshow::loop"));
if (g_file_info_get_attribute_status (file_data->info, "slideshow::delay") == G_FILE_ATTRIBUTE_STATUS_SET)
g_value_hash_set_float (catalog->attributes,
"slideshow::delay",
g_file_info_get_attribute_int32 (file_data->info, "slideshow::delay") / 10.0);
g_value_hash_set_int (catalog->attributes,
"slideshow::delay",
g_file_info_get_attribute_int32 (file_data->info, "slideshow::delay"));
if (g_file_info_get_attribute_status (file_data->info, "slideshow::transition") == G_FILE_ATTRIBUTE_STATUS_SET)
g_value_hash_set_string (catalog->attributes,
"slideshow::transition",
......@@ -202,7 +202,7 @@ ss__gth_catalog_write_metadata (GthCatalog *catalog,
if (g_value_hash_is_set (catalog->attributes, "slideshow::delay")) {
g_file_info_set_attribute_int32 (file_data->info,
"slideshow::delay",
(int) g_value_hash_get_float (catalog->attributes, "slideshow::delay") * 10.0);
g_value_hash_get_int (catalog->attributes, "slideshow::delay"));
g_file_info_set_attribute_status (file_data->info,
"slideshow::delay",
G_FILE_ATTRIBUTE_STATUS_SET);
......@@ -258,12 +258,12 @@ ss__gth_catalog_read_from_doc (GthCatalog *catalog,
for (child = node->first_child; child; child = child->next_sibling) {
if (g_strcmp0 (child->tag_name, "delay") == 0) {
float delay;
int delay;
sscanf (dom_element_get_inner_text (child), "%f", &delay);
g_value_hash_set_float (catalog->attributes,
"slideshow::delay",
delay);
sscanf (dom_element_get_inner_text (child), "%d", &delay);
g_value_hash_set_int (catalog->attributes,
"slideshow::delay",
delay);
}
else if (g_strcmp0 (child->tag_name, "transition") == 0) {
g_value_hash_set_string (catalog->attributes,
......@@ -323,7 +323,7 @@ ss__gth_catalog_write_to_doc (GthCatalog *catalog,
NULL);
dom_element_append_child (root, slideshow);
delay = g_strdup_printf ("%f", g_value_hash_get_float (catalog->attributes, "slideshow::delay"));
delay = g_strdup_printf ("%d", g_value_hash_get_int (catalog->attributes, "slideshow::delay"));
dom_element_append_child (slideshow,
dom_document_create_element_with_text (doc, delay, "delay", NULL));
g_free (delay);
......@@ -362,7 +362,7 @@ ss__dlg_catalog_properties (GtkBuilder *builder,
current_transition = eel_gconf_get_string (PREF_SLIDESHOW_TRANSITION, DEFAULT_TRANSITION);
slideshow_preferences = gth_slideshow_preferences_new (current_transition,
eel_gconf_get_boolean (PREF_SLIDESHOW_AUTOMATIC, TRUE),
eel_gconf_get_float (PREF_SLIDESHOW_CHANGE_DELAY, 5.0),
(int) (1000.0 * eel_gconf_get_float (PREF_SLIDESHOW_CHANGE_DELAY, 5.0)),
eel_gconf_get_boolean (PREF_SLIDESHOW_WRAP_AROUND, FALSE));
gtk_widget_set_sensitive (gth_slideshow_preferences_get_widget (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences), "personalize_box"), FALSE);
......@@ -371,7 +371,7 @@ ss__dlg_catalog_properties (GtkBuilder *builder,
else {
slideshow_preferences = gth_slideshow_preferences_new (g_value_hash_get_string (catalog->attributes, "slideshow::transition"),
g_value_hash_get_boolean (catalog->attributes, "slideshow::auto"),
g_value_hash_get_float (catalog->attributes, "slideshow::delay"),
g_value_hash_get_int (catalog->attributes, "slideshow::delay"),
g_value_hash_get_boolean (catalog->attributes, "slideshow::loop"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gth_slideshow_preferences_get_widget (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences), "personalize_checkbutton")), TRUE);
gtk_widget_set_sensitive (gth_slideshow_preferences_get_widget (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences), "personalize_box"), TRUE);
......@@ -419,9 +419,9 @@ ss__dlg_catalog_properties_save (GtkBuilder *builder,
g_value_hash_set_boolean (catalog->attributes,
"slideshow::auto",
gth_slideshow_preferences_get_automatic (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences)));
g_value_hash_set_float (catalog->attributes,
"slideshow::delay",
gth_slideshow_preferences_get_delay (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences)));
g_value_hash_set_int (catalog->attributes,
"slideshow::delay",
gth_slideshow_preferences_get_delay (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences)));
g_value_hash_set_boolean (catalog->attributes,
"slideshow::loop",
gth_slideshow_preferences_get_wrap_around (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences)));
......
......@@ -232,7 +232,7 @@ static void
gth_slideshow_preferences_construct (GthSlideshowPreferences *self,
const char *current_transition,
gboolean automatic,
float delay,
int delay,
gboolean wrap_around)
{
GtkListStore *model;
......@@ -285,7 +285,7 @@ gth_slideshow_preferences_construct (GthSlideshowPreferences *self,
gtk_container_add (GTK_CONTAINER (_gtk_builder_get_widget (self->priv->builder, "transition_box")), self->priv->transition_combobox);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_gtk_builder_get_widget (self->priv->builder, "automatic_checkbutton")), automatic);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (_gtk_builder_get_widget (self->priv->builder, "change_delay_spinbutton")), delay);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (_gtk_builder_get_widget (self->priv->builder, "change_delay_spinbutton")), ((float) delay) / 1000.0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_gtk_builder_get_widget (self->priv->builder, "wrap_around_checkbutton")), wrap_around);
/* signals */
......@@ -312,7 +312,7 @@ gth_slideshow_preferences_construct (GthSlideshowPreferences *self,
GtkWidget *
gth_slideshow_preferences_new (const char *transition,
gboolean automatic,
float delay,
int delay,
gboolean wrap_around)
{
GtkWidget *widget;
......@@ -411,10 +411,10 @@ gth_slideshow_preferences_get_automatic (GthSlideshowPreferences *self)
}
float
int
gth_slideshow_preferences_get_delay (GthSlideshowPreferences *self)
{
return (float) gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (self->priv->builder, "change_delay_spinbutton")));
return (int) (1000.0 * gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (self->priv->builder, "change_delay_spinbutton"))));
}
......
......@@ -52,7 +52,7 @@ struct _GthSlideshowPreferencesClass
GType gth_slideshow_preferences_get_type (void);
GtkWidget * gth_slideshow_preferences_new (const char *transition,
gboolean automatic,
float delay,
int delay,
gboolean wrap_around);
void gth_slideshow_preferences_set_audio (GthSlideshowPreferences *self,
gboolean loop,
......@@ -62,7 +62,7 @@ GtkWidget * gth_slideshow_preferences_get_widget (GthSlideshowPreferen
gboolean gth_slideshow_preferences_get_personalize (GthSlideshowPreferences *self);
char * gth_slideshow_preferences_get_transition_id (GthSlideshowPreferences *self);
gboolean gth_slideshow_preferences_get_automatic (GthSlideshowPreferences *self);
float gth_slideshow_preferences_get_delay (GthSlideshowPreferences *self);
int gth_slideshow_preferences_get_delay (GthSlideshowPreferences *self);
gboolean gth_slideshow_preferences_get_wrap_around (GthSlideshowPreferences *self);
char ** gth_slideshow_preferences_get_audio_files (GthSlideshowPreferences *self);
gboolean gth_slideshow_preferences_get_audio_loop (GthSlideshowPreferences *self);
......
......@@ -97,7 +97,7 @@ ss__dlg_preferences_construct_cb (GtkWidget *dialog,
current_transition = eel_gconf_get_string (PREF_SLIDESHOW_TRANSITION, DEFAULT_TRANSITION);
data->preferences_page = gth_slideshow_preferences_new (current_transition,
eel_gconf_get_boolean (PREF_SLIDESHOW_AUTOMATIC, TRUE),
eel_gconf_get_float (PREF_SLIDESHOW_CHANGE_DELAY, 5.0),
(int) (1000.0 * eel_gconf_get_float (PREF_SLIDESHOW_CHANGE_DELAY, 5.0)),
eel_gconf_get_boolean (PREF_SLIDESHOW_WRAP_AROUND, FALSE));
gtk_widget_show (data->preferences_page);
g_free (current_transition);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment