summaryrefslogtreecommitdiff
path: root/src/totem-menu.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2022-02-11 12:39:40 +0100
committerBastien Nocera <hadess@hadess.net>2022-02-11 14:25:19 +0100
commitab8d0f3b1b67cddd886d919c54c07b5e5c68e001 (patch)
tree35ae35410bbd25288f4ee5d13e4c4ab2225e125d /src/totem-menu.c
parent3a2528ec1e875392a39b7521e8d30cce00f39dea (diff)
downloadtotem-ab8d0f3b1b67cddd886d919c54c07b5e5c68e001.tar.gz
backend: Move subtitles/languages list caching to video widget
Instead of having the front-end keep track of track lists, and compare them, keep them inside the video widget. This also fixes the old totem-menu code that didn't check for title equality when comparing lists. Note that this updates the subtitles and languages menu too often, as we're *always* updating the menu even when it hasn't changed. Fixes: becbe7f8ef61f51ccbbb228f248b85b02e1eeab9
Diffstat (limited to 'src/totem-menu.c')
-rw-r--r--src/totem-menu.c58
1 files changed, 2 insertions, 56 deletions
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 42bc93019..dfd9d8866 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -544,39 +544,6 @@ create_lang_actions (GMenu *menu,
g_list_free_full (ui_list, (GDestroyNotify) g_free);
}
-static gboolean
-totem_sublang_equal_lists (GList *orig, GList *new)
-{
- GList *o, *n;
- gboolean retval;
-
- if ((orig == NULL && new != NULL) || (orig != NULL && new == NULL))
- return FALSE;
- if (orig == NULL && new == NULL)
- return TRUE;
-
- if (g_list_length (orig) != g_list_length (new))
- return FALSE;
-
- retval = TRUE;
- o = orig;
- n = new;
- while (o != NULL && n != NULL && retval != FALSE) {
- BvwLangInfo *info_o, *info_n;
-
- info_o = o->data;
- info_n = n->data;
- if (g_strcmp0 (info_o->language, info_n->language) != 0)
- retval = FALSE;
- if (g_strcmp0 (info_o->codec, info_n->codec) != 0)
- retval = FALSE;
- o = g_list_next (o);
- n = g_list_next (n);
- }
-
- return retval;
-}
-
static void
totem_languages_update (Totem *totem, GList *list)
{
@@ -597,9 +564,6 @@ totem_languages_update (Totem *totem, GList *list)
current = bacon_video_widget_get_language (totem->bvw);
g_action_change_state (action, g_variant_new_int32 (current));
totem->updating_menu = FALSE;
-
- g_list_free_full (totem->languages_list, (GDestroyNotify) bacon_video_widget_lang_info_free);
- totem->languages_list = list;
}
static void
@@ -622,9 +586,6 @@ totem_subtitles_update (Totem *totem, GList *list)
current = bacon_video_widget_get_subtitle (totem->bvw);
g_action_change_state (action, g_variant_new_int32 (current));
totem->updating_menu = FALSE;
-
- g_list_free_full (totem->subtitles_list, (GDestroyNotify) bacon_video_widget_lang_info_free);
- totem->subtitles_list = list;
}
void
@@ -633,23 +594,8 @@ totem_sublang_update (Totem *totem)
GList *list;
list = bacon_video_widget_get_languages (totem->bvw);
- if (totem_sublang_equal_lists (totem->languages_list, list) == TRUE) {
- g_list_free_full (list, (GDestroyNotify) bacon_video_widget_lang_info_free);
- } else {
- totem_languages_update (totem, list);
- }
+ totem_languages_update (totem, list);
list = bacon_video_widget_get_subtitles (totem->bvw);
- if (totem_sublang_equal_lists (totem->subtitles_list, list) == TRUE) {
- g_list_free_full (list, (GDestroyNotify) bacon_video_widget_lang_info_free);
- } else {
- totem_subtitles_update (totem, list);
- }
-}
-
-void
-totem_sublang_exit (Totem *totem)
-{
- g_list_free_full (totem->subtitles_list, (GDestroyNotify) bacon_video_widget_lang_info_free);
- g_list_free_full (totem->languages_list, (GDestroyNotify) bacon_video_widget_lang_info_free);
+ totem_subtitles_update (totem, list);
}