Commit a7b72ebb authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

[slideshow] removed option, renamed attributes

Removed the option to restart the background audio, now it will
always restarted.  Renamed some attributes to be consinstent with
the API.
parent 49ab805a
......@@ -51,21 +51,20 @@ 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"));
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"));
gth_slideshow_set_automatic (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_boolean (location->info, "slideshow::automatic"));
gth_slideshow_set_wrap_around (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_boolean (location->info, "slideshow::wrap-around"));
transition_id = g_strdup (g_file_info_get_attribute_string (location->info, "slideshow::transition"));
}
else {
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));
gth_slideshow_set_wrap_around (GTH_SLIDESHOW (slideshow), eel_gconf_get_boolean (PREF_SLIDESHOW_WRAP_AROUND, FALSE));
transition_id = eel_gconf_get_string (PREF_SLIDESHOW_TRANSITION, DEFAULT_TRANSITION);
}
if (g_file_info_get_attribute_status (location->info, "slideshow::audio-files") == G_FILE_ATTRIBUTE_STATUS_SET)
if (g_file_info_get_attribute_status (location->info, "slideshow::playlist") == G_FILE_ATTRIBUTE_STATUS_SET)
gth_slideshow_set_playlist (GTH_SLIDESHOW (slideshow),
g_file_info_get_attribute_stringv (location->info, "slideshow::audio-files"),
g_file_info_get_attribute_boolean (location->info, "slideshow::audio-loop"));
g_file_info_get_attribute_stringv (location->info, "slideshow::playlist"));
if (strcmp (transition_id, "random") == 0) {
GList *scan;
......
......@@ -144,14 +144,14 @@ ss__gth_catalog_read_metadata (GthCatalog *catalog,
g_value_hash_set_boolean (catalog->attributes,
"slideshow::personalize",
g_file_info_get_attribute_boolean (file_data->info, "slideshow::personalize"));
if (g_file_info_get_attribute_status (file_data->info, "slideshow::auto") == G_FILE_ATTRIBUTE_STATUS_SET)
if (g_file_info_get_attribute_status (file_data->info, "slideshow::automatic") == G_FILE_ATTRIBUTE_STATUS_SET)
g_value_hash_set_boolean (catalog->attributes,
"slideshow::auto",
g_file_info_get_attribute_boolean (file_data->info, "slideshow::auto"));
if (g_file_info_get_attribute_status (file_data->info, "slideshow::loop") == G_FILE_ATTRIBUTE_STATUS_SET)
"slideshow::automatic",
g_file_info_get_attribute_boolean (file_data->info, "slideshow::automatic"));
if (g_file_info_get_attribute_status (file_data->info, "slideshow::wrap-around") == G_FILE_ATTRIBUTE_STATUS_SET)
g_value_hash_set_boolean (catalog->attributes,
"slideshow::loop",
g_file_info_get_attribute_boolean (file_data->info, "slideshow::loop"));
"slideshow::wrap-around",
g_file_info_get_attribute_boolean (file_data->info, "slideshow::wrap-around"));
if (g_file_info_get_attribute_status (file_data->info, "slideshow::delay") == G_FILE_ATTRIBUTE_STATUS_SET)
g_value_hash_set_int (catalog->attributes,
"slideshow::delay",
......@@ -160,14 +160,10 @@ ss__gth_catalog_read_metadata (GthCatalog *catalog,
g_value_hash_set_string (catalog->attributes,
"slideshow::transition",
g_file_info_get_attribute_string (file_data->info, "slideshow::transition"));
if (g_file_info_get_attribute_status (file_data->info, "slideshow::audio-loop") == G_FILE_ATTRIBUTE_STATUS_SET)
g_value_hash_set_boolean (catalog->attributes,
"slideshow::audio-loop",
g_file_info_get_attribute_boolean (file_data->info, "slideshow::audio-loop"));
if (g_file_info_get_attribute_status (file_data->info, "slideshow::audio-files") == G_FILE_ATTRIBUTE_STATUS_SET)
if (g_file_info_get_attribute_status (file_data->info, "slideshow::playlist") == G_FILE_ATTRIBUTE_STATUS_SET)
g_value_hash_set_stringv (catalog->attributes,
"slideshow::audio-files",
g_file_info_get_attribute_stringv (file_data->info, "slideshow::audio-files"));
"slideshow::playlist",
g_file_info_get_attribute_stringv (file_data->info, "slideshow::playlist"));
}
......@@ -183,20 +179,20 @@ ss__gth_catalog_write_metadata (GthCatalog *catalog,
"slideshow::personalize",
G_FILE_ATTRIBUTE_STATUS_SET);
}
if (g_value_hash_is_set (catalog->attributes, "slideshow::auto")) {
if (g_value_hash_is_set (catalog->attributes, "slideshow::automatic")) {
g_file_info_set_attribute_boolean (file_data->info,
"slideshow::auto",
g_value_hash_get_boolean (catalog->attributes, "slideshow::auto"));
"slideshow::automatic",
g_value_hash_get_boolean (catalog->attributes, "slideshow::automatic"));
g_file_info_set_attribute_status (file_data->info,
"slideshow::auto",
"slideshow::automatic",
G_FILE_ATTRIBUTE_STATUS_SET);
}
if (g_value_hash_is_set (catalog->attributes, "slideshow::loop")) {
if (g_value_hash_is_set (catalog->attributes, "slideshow::wrap-around")) {
g_file_info_set_attribute_boolean (file_data->info,
"slideshow::loop",
g_value_hash_get_boolean (catalog->attributes, "slideshow::loop"));
"slideshow::wrap-around",
g_value_hash_get_boolean (catalog->attributes, "slideshow::wrap-around"));
g_file_info_set_attribute_status (file_data->info,
"slideshow::loop",
"slideshow::wrap-around",
G_FILE_ATTRIBUTE_STATUS_SET);
}
if (g_value_hash_is_set (catalog->attributes, "slideshow::delay")) {
......@@ -215,20 +211,12 @@ ss__gth_catalog_write_metadata (GthCatalog *catalog,
"slideshow::transition",
G_FILE_ATTRIBUTE_STATUS_SET);
}
if (g_value_hash_is_set (catalog->attributes, "slideshow::audio-loop")) {
g_file_info_set_attribute_boolean (file_data->info,
"slideshow::audio-loop",
g_value_hash_get_boolean (catalog->attributes, "slideshow::audio-loop"));
g_file_info_set_attribute_status (file_data->info,
"slideshow::audio-loop",
G_FILE_ATTRIBUTE_STATUS_SET);
}
if (g_value_hash_is_set (catalog->attributes, "slideshow::audio-files")) {
if (g_value_hash_is_set (catalog->attributes, "slideshow::playlist")) {
g_file_info_set_attribute_stringv (file_data->info,
"slideshow::audio-files",
g_value_hash_get_stringv (catalog->attributes, "slideshow::audio-files"));
"slideshow::playlist",
g_value_hash_get_stringv (catalog->attributes, "slideshow::playlist"));
g_file_info_set_attribute_status (file_data->info,
"slideshow::audio-files",
"slideshow::playlist",
G_FILE_ATTRIBUTE_STATUS_SET);
}
}
......@@ -250,11 +238,11 @@ ss__gth_catalog_read_from_doc (GthCatalog *catalog,
"slideshow::personalize",
g_strcmp0 (dom_element_get_attribute (node, "personalize"), "true") == 0);
g_value_hash_set_boolean (catalog->attributes,
"slideshow::auto",
g_strcmp0 (dom_element_get_attribute (node, "auto"), "true") == 0);
"slideshow::automatic",
g_strcmp0 (dom_element_get_attribute (node, "automatic"), "true") == 0);
g_value_hash_set_boolean (catalog->attributes,
"slideshow::loop",
g_strcmp0 (dom_element_get_attribute (node, "loop"), "true") == 0);
"slideshow::wrap-around",
g_strcmp0 (dom_element_get_attribute (node, "wrap-around"), "true") == 0);
for (child = node->first_child; child; child = child->next_sibling) {
if (g_strcmp0 (child->tag_name, "delay") == 0) {
......@@ -270,32 +258,29 @@ ss__gth_catalog_read_from_doc (GthCatalog *catalog,
"slideshow::transition",
dom_element_get_inner_text (child));
}
else if (g_strcmp0 (child->tag_name, "audio") == 0) {
else if (g_strcmp0 (child->tag_name, "playlist") == 0) {
DomElement *file;
GList *audio_files;
g_value_hash_set_boolean (catalog->attributes,
"slideshow::audio-loop",
g_strcmp0 (dom_element_get_attribute (child, "loop"), "true") == 0);
audio_files = NULL;
for (file = child->first_child; file; file = file->next_sibling) {
if (g_strcmp0 (file->tag_name, "file") == 0)
audio_files = g_list_prepend (audio_files, g_strdup (dom_element_get_attribute (file, "uri")));
}
audio_files = g_list_reverse (audio_files);
if (audio_files != NULL) {
char **audio_files_v;
audio_files_v = _g_string_list_to_strv (audio_files);
g_value_hash_set_stringv (catalog->attributes,
"slideshow::audio-files",
"slideshow::playlist",
audio_files_v);
g_strfreev (audio_files_v);
}
else
g_value_hash_unset (catalog->attributes, "slideshow::audio-files");
g_value_hash_unset (catalog->attributes, "slideshow::playlist");
_g_string_list_free (audio_files);
}
......@@ -311,15 +296,13 @@ ss__gth_catalog_write_to_doc (GthCatalog *catalog,
{
DomElement *slideshow;
char *delay;
DomElement *audio;
char **audio_files;
int i;
char **playlist_files;
slideshow = dom_document_create_element (doc,
"slideshow",
"personalize", (g_value_hash_get_boolean (catalog->attributes, "slideshow::personalize") ? "true" : "false"),
"auto", (g_value_hash_get_boolean (catalog->attributes, "slideshow::auto") ? "true" : "false"),
"loop", (g_value_hash_get_boolean (catalog->attributes, "slideshow::loop") ? "true" : "false"),
"automatic", (g_value_hash_get_boolean (catalog->attributes, "slideshow::automatic") ? "true" : "false"),
"wrap-around", (g_value_hash_get_boolean (catalog->attributes, "slideshow::wrap-around") ? "true" : "false"),
NULL);
dom_element_append_child (root, slideshow);
......@@ -334,15 +317,17 @@ ss__gth_catalog_write_to_doc (GthCatalog *catalog,
"transition",
NULL));
audio = dom_document_create_element (doc,
"audio",
"loop", (g_value_hash_get_boolean (catalog->attributes, "slideshow::audio-loop") ? "true" : "false"),
NULL);
dom_element_append_child (slideshow, audio);
playlist_files = g_value_hash_get_stringv (catalog->attributes, "slideshow::playlist");
if (playlist_files[0] != NULL) {
DomElement *playlist;
int i;
playlist = dom_document_create_element (doc, "playlist", NULL);
dom_element_append_child (slideshow, playlist);
audio_files = g_value_hash_get_stringv (catalog->attributes, "slideshow::audio-files");
for (i = 0; audio_files[i] != NULL; i++)
dom_element_append_child (audio, dom_document_create_element (doc, "file", "uri", audio_files[i], NULL));
for (i = 0; playlist_files[i] != NULL; i++)
dom_element_append_child (playlist, dom_document_create_element (doc, "file", "uri", playlist_files[i], NULL));
}
}
......@@ -370,17 +355,16 @@ 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_boolean (catalog->attributes, "slideshow::automatic"),
g_value_hash_get_int (catalog->attributes, "slideshow::delay"),
g_value_hash_get_boolean (catalog->attributes, "slideshow::loop"));
g_value_hash_get_boolean (catalog->attributes, "slideshow::wrap-around"));
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);
}
if (g_value_hash_is_set (catalog->attributes, "slideshow::audio-files"))
if (g_value_hash_is_set (catalog->attributes, "slideshow::playlist"))
gth_slideshow_preferences_set_audio (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences),
g_value_hash_get_boolean (catalog->attributes, "slideshow::audio-loop"),
g_value_hash_get_stringv (catalog->attributes, "slideshow::audio-files"));
g_value_hash_get_stringv (catalog->attributes, "slideshow::playlist"));
gtk_widget_show (gth_slideshow_preferences_get_widget (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences), "personalize_checkbutton"));
gtk_widget_hide (gth_slideshow_preferences_get_widget (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences), "slideshow_label"));
......@@ -417,22 +401,18 @@ ss__dlg_catalog_properties_save (GtkBuilder *builder,
g_free (transition_id);
g_value_hash_set_boolean (catalog->attributes,
"slideshow::auto",
"slideshow::automatic",
gth_slideshow_preferences_get_automatic (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",
"slideshow::wrap-around",
gth_slideshow_preferences_get_wrap_around (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences)));
files = gth_slideshow_preferences_get_audio_files (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences));
g_value_hash_set_stringv (catalog->attributes,
"slideshow::audio-files",
"slideshow::playlist",
files);
g_strfreev (files);
g_value_hash_set_boolean (catalog->attributes,
"slideshow::audio-loop",
gth_slideshow_preferences_get_audio_loop (GTH_SLIDESHOW_PREFERENCES (slideshow_preferences)));
}
......@@ -269,6 +269,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Add files to the playlist</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
......@@ -286,6 +287,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Remove the selected files</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
......@@ -309,20 +311,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="loop_checkbutton">
<property name="label" translatable="yes">Play c_ontinuously</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
......
......@@ -335,15 +335,12 @@ gth_slideshow_preferences_new (const char *transition,
void
gth_slideshow_preferences_set_audio (GthSlideshowPreferences *self,
gboolean loop,
char **files)
{
GthIconCache *icon_cache;
GtkListStore *list_store;
int i;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_gtk_builder_get_widget (self->priv->builder, "loop_checkbutton")), loop);
icon_cache = gth_icon_cache_new_for_widget(GTK_WIDGET (self), GTK_ICON_SIZE_MENU);
list_store = (GtkListStore *) gtk_builder_get_object (self->priv->builder, "files_liststore");
gtk_list_store_clear (list_store);
......@@ -457,10 +454,3 @@ gth_slideshow_preferences_get_audio_files (GthSlideshowPreferences *self)
return files_v;
}
gboolean
gth_slideshow_preferences_get_audio_loop (GthSlideshowPreferences *self)
{
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "loop_checkbutton")));
}
......@@ -55,7 +55,6 @@ GtkWidget * gth_slideshow_preferences_new (const char
int delay,
gboolean wrap_around);
void gth_slideshow_preferences_set_audio (GthSlideshowPreferences *self,
gboolean loop,
char **files);
GtkWidget * gth_slideshow_preferences_get_widget (GthSlideshowPreferences *self,
const char *name);
......@@ -65,7 +64,6 @@ gboolean gth_slideshow_preferences_get_automatic (GthSlideshowPreferen
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);
G_END_DECLS
......
......@@ -39,7 +39,7 @@ struct _GthSlideshowPrivate {
GthBrowser *browser;
GList *file_list; /* GthFileData */
gboolean automatic;
gboolean loop;
gboolean wrap_around;
GList *current;
GthImagePreloader *preloader;
GList *transitions; /* GthTransition */
......@@ -96,7 +96,7 @@ _gth_slideshow_load_current_image (GthSlideshow *self)
}
if (self->priv->current == NULL) {
if (! self->priv->one_loaded || ! self->priv->loop) {
if (! self->priv->one_loaded || ! self->priv->wrap_around) {
_gth_slideshow_close (self);
return;
}
......@@ -400,7 +400,7 @@ gth_slideshow_init (GthSlideshow *self)
self->priv->next_event = 0;
self->priv->delay = DEFAULT_DELAY;
self->priv->automatic = FALSE;
self->priv->loop = FALSE;
self->priv->wrap_around = FALSE;
self->priv->transitions = NULL;
self->priv->n_transitions = 0;
self->priv->rand = g_rand_new ();
......@@ -689,10 +689,10 @@ gth_slideshow_set_automatic (GthSlideshow *self,
void
gth_slideshow_set_loop (GthSlideshow *self,
gboolean loop)
gth_slideshow_set_wrap_around (GthSlideshow *self,
gboolean wrap_around)
{
self->priv->loop = loop;
self->priv->wrap_around = wrap_around;
}
......@@ -708,9 +708,8 @@ gth_slideshow_set_transitions (GthSlideshow *self,
void
gth_slideshow_set_playlist (GthSlideshow *self,
char **files,
gboolean loop)
char **files)
{
self->priv->audio_files = g_strdupv (files);
self->priv->audio_loop = loop;
self->priv->audio_loop = TRUE;
}
......@@ -64,13 +64,12 @@ void gth_slideshow_set_delay (GthSlideshow *self,
guint msecs);
void gth_slideshow_set_automatic (GthSlideshow *self,
gboolean automatic);
void gth_slideshow_set_loop (GthSlideshow *self,
gboolean loop);
void gth_slideshow_set_wrap_around (GthSlideshow *self,
gboolean wrap_around);
void gth_slideshow_set_transitions (GthSlideshow *self,
GList *transitions);
void gth_slideshow_set_playlist (GthSlideshow *self,
char **files,
gboolean loop);
char **files);
G_END_DECLS
......
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