Commit 1c4bedf0 authored by Bastien Nocera's avatar Bastien Nocera Committed by Bastien Nocera

Add a preference as to whether or not to load text subtitles automatically

2007-10-19  Bastien Nocera  <hadess@hadess.net>

	* data/totem.schemas.in:
	* data/totem.ui:
	* src/totem-preferences.c: (checkbutton3_toggled_cb),
	(autoload_subtitles_changed_cb), (totem_setup_preferences):
	* src/totem-private.h:
	* src/totem.c: (totem_action_set_mrl_with_warning),
	(totem_action_drop_files), (totem_action_set_playlist_index),
	(playlist_changed_cb), (totem_action_handle_key_press),
	(playlist_widget_setup):
	Add a preference as to whether or not to load text subtitles
	automatically when a new file is loaded. It's off by default,
	as it makes loading videos slower for everyone that doesn't
	want/need this feature (Closes: #481822)


svn path=/trunk/; revision=4789
parent cd1d8a0d
2007-10-19 Bastien Nocera <hadess@hadess.net>
* data/totem.schemas.in:
* data/totem.ui:
* src/totem-preferences.c: (checkbutton3_toggled_cb),
(autoload_subtitles_changed_cb), (totem_setup_preferences):
* src/totem-private.h:
* src/totem.c: (totem_action_set_mrl_with_warning),
(totem_action_drop_files), (totem_action_set_playlist_index),
(playlist_changed_cb), (totem_action_handle_key_press),
(playlist_widget_setup):
Add a preference as to whether or not to load text subtitles
automatically when a new file is loaded. It's off by default,
as it makes loading videos slower for everyone that doesn't
want/need this feature (Closes: #481822)
2007-10-19 Bastien Nocera <hadess@hadess.net>
* src/plparse/totem-pl-parser-podcast.c:
......
......@@ -260,5 +260,19 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/totem/autoload_subtitles</key>
<applyto>/apps/totem/autoload_subtitles</applyto>
<owner>totem</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Whether to autoload text subtitle files when a movie is loaded</short>
<long>
Whether to autoload text subtitle files when a movie is loaded
</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>
......@@ -905,12 +905,35 @@
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkCheckButton" id="tpw_auto_subtitles_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Automatically _load subtitle files when movie is loaded</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="checkbutton3_toggled_cb"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label32">
<property name="visible">True</property>
......@@ -933,8 +956,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"/>
</packing>
......@@ -962,8 +985,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"/>
</packing>
......@@ -979,8 +1002,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
......@@ -1000,8 +1023,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"/>
</packing>
</child>
......
......@@ -47,6 +47,7 @@
/* Callback functions for GtkBuilder */
void checkbutton1_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
void checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
void checkbutton3_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
void tvout_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
void connection_combobox_changed (GtkComboBox *combobox, Totem *totem);
void visual_menu_changed (GtkComboBox *combobox, Totem *totem);
......@@ -184,6 +185,18 @@ checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
totem_prefs_set_show_visuals (totem, value, TRUE);
}
void
checkbutton3_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
{
gboolean value;
value = gtk_toggle_button_get_active (togglebutton);
gconf_client_set_bool (totem->gc,
GCONF_PREFIX"/autoload_subtitles", value, NULL);
totem->autoload_subs = value;
}
void
tvout_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
{
......@@ -256,6 +269,24 @@ show_vfx_changed_cb (GConfClient *client, guint cnxn_id,
G_CALLBACK (checkbutton2_toggled_cb), totem);
}
static void
autoload_subtitles_changed_cb (GConfClient *client, guint cnxn_id,
GConfEntry *entry, Totem *totem)
{
GObject *item;
item = gtk_builder_get_object (totem->xml, "tpw_auto_subtitles_checkbutton");
g_signal_handlers_disconnect_by_func (item,
checkbutton3_toggled_cb, totem);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item),
gconf_client_get_bool (totem->gc,
GCONF_PREFIX"/autoload_subtitles", NULL));
g_signal_connect (item, "toggled",
G_CALLBACK (checkbutton3_toggled_cb), totem);
}
static void
disable_save_to_disk_changed_cb (GConfClient *client, guint cnxn_id,
GConfEntry *entry, Totem *totem)
......@@ -530,6 +561,19 @@ totem_setup_preferences (Totem *totem)
(GConfClientNotifyFunc) show_vfx_changed_cb,
totem, NULL, NULL);
/* Auto-load subtitles */
item = gtk_builder_get_object (totem->xml, "tpw_auto_subtitles_checkbutton");
totem->autoload_subs = gconf_client_get_bool (totem->gc,
GCONF_PREFIX"/autoload_subtitles", NULL);
g_signal_handlers_disconnect_by_func (item, checkbutton3_toggled_cb, totem);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), totem->autoload_subs);
g_signal_connect (item, "toggled", G_CALLBACK (checkbutton3_toggled_cb), totem);
gconf_client_notify_add (totem->gc, GCONF_PREFIX"/autoload_subtitles",
(GConfClientNotifyFunc) autoload_subtitles_changed_cb,
totem, NULL, NULL);
/* Visuals list */
list = bacon_video_widget_get_visuals_list (totem->bvw);
menu = gtk_menu_new ();
......
......@@ -121,6 +121,7 @@ struct TotemObject {
GtkWidget *languages;
GList *subtitles_list;
GList *language_list;
gboolean autoload_subs;
/* Fullscreen */
TotemFullscreen *fs;
......
......@@ -841,7 +841,7 @@ update_mrl_label (Totem *totem, const char *name)
/* Get the length of the stream */
time = bacon_video_widget_get_stream_length (totem->bvw);
totem_statusbar_set_time_and_length (TOTEM_STATUSBAR
(totem->statusbar), 0, time / 1000);
(totem->statusbar), 0, time / 1000);
g_object_notify (G_OBJECT (totem), "stream-length");
......@@ -914,12 +914,13 @@ totem_action_set_mrl_with_warning (Totem *totem, const char *mrl,
} else {
gboolean caps;
gdouble volume;
char *subtitle_uri;
char *subtitle_uri = NULL;
GError *err = NULL;
bacon_video_widget_set_logo_mode (totem->bvw, FALSE);
subtitle_uri = totem_uri_get_subtitle_uri (mrl);
if (totem->autoload_subs != FALSE)
subtitle_uri = totem_uri_get_subtitle_uri (mrl);
totem_gdk_window_set_waiting_cursor (totem->win->window);
retval = bacon_video_widget_open_with_subtitle (totem->bvw,
mrl, subtitle_uri, &err);
......@@ -1381,14 +1382,14 @@ on_got_redirect (BaconVideoWidget *bvw, const char *mrl, Totem *totem)
g_free (new_mrl);
}
/* This is only called when we are playing a DVD */
/* This is only called when we are playing a DVD or a radio */
static void
on_title_change_event (BaconVideoWidget *bvw, const char *string, Totem *totem)
{
update_mrl_label (totem, string);
update_buttons (totem);
totem_playlist_set_title (TOTEM_PLAYLIST (totem->playlist),
string, TRUE);
string, TRUE);
}
static void
......
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