[gthumb] [slideshow] save the delay in milliseconds



commit 46e13997ba6a3e9be802b13e143ab613506ba119
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Feb 16 10:56:30 2010 +0100

    [slideshow] save the delay in milliseconds

 extensions/slideshow/actions.c                   |    4 +-
 extensions/slideshow/callbacks.c                 |   30 +++++++++++-----------
 extensions/slideshow/gth-slideshow-preferences.c |   10 +++---
 extensions/slideshow/gth-slideshow-preferences.h |    4 +-
 extensions/slideshow/preferences.c               |    2 +-
 5 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/extensions/slideshow/actions.c b/extensions/slideshow/actions.c
index 8c76840..ff34a7b 100644
--- a/extensions/slideshow/actions.c
+++ b/extensions/slideshow/actions.c
@@ -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);
diff --git a/extensions/slideshow/callbacks.c b/extensions/slideshow/callbacks.c
index 5f9ed8f..df3e07f 100644
--- a/extensions/slideshow/callbacks.c
+++ b/extensions/slideshow/callbacks.c
@@ -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)));
diff --git a/extensions/slideshow/gth-slideshow-preferences.c b/extensions/slideshow/gth-slideshow-preferences.c
index e41b4f0..4be42f8 100644
--- a/extensions/slideshow/gth-slideshow-preferences.c
+++ b/extensions/slideshow/gth-slideshow-preferences.c
@@ -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"))));
 }
 
 
diff --git a/extensions/slideshow/gth-slideshow-preferences.h b/extensions/slideshow/gth-slideshow-preferences.h
index b0b0c57..77da33e 100644
--- a/extensions/slideshow/gth-slideshow-preferences.h
+++ b/extensions/slideshow/gth-slideshow-preferences.h
@@ -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);
diff --git a/extensions/slideshow/preferences.c b/extensions/slideshow/preferences.c
index e318c82..24db38e 100644
--- a/extensions/slideshow/preferences.c
+++ b/extensions/slideshow/preferences.c
@@ -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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]