Don't use deprecated GTK API

Fixes bug #585758.
This commit is contained in:
Sebastian Dröge 2009-06-14 20:30:59 +02:00
parent 45084bf579
commit 81a0a98611
3 changed files with 32 additions and 39 deletions

View file

@ -300,7 +300,7 @@ start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
} }
if (changed_id == 0) { if (changed_id == 0) {
changed_id = gtk_signal_connect (GTK_OBJECT (hscale), changed_id = g_signal_connect (GTK_OBJECT (hscale),
"value_changed", G_CALLBACK (seek_cb), pipeline); "value_changed", G_CALLBACK (seek_cb), pipeline);
} }
@ -407,7 +407,7 @@ bus_message (GstBus * bus, GstMessage * message, gpointer data)
GST_DEBUG ("segment_done, doing next seek"); GST_DEBUG ("segment_done, doing next seek");
if (!do_seek (hscale, FALSE, update_id == 0)) { if (!do_seek (hscale, FALSE, update_id == 0)) {
if (changed_id == 0) { if (changed_id == 0) {
changed_id = gtk_signal_connect (GTK_OBJECT (hscale), changed_id = g_signal_connect (GTK_OBJECT (hscale),
"value_changed", G_CALLBACK (seek_cb), pipeline); "value_changed", G_CALLBACK (seek_cb), pipeline);
} }
} }
@ -513,14 +513,14 @@ main (int argc, char **argv)
gtk_scale_set_digits (GTK_SCALE (shscale), 2); gtk_scale_set_digits (GTK_SCALE (shscale), 2);
gtk_range_set_update_policy (GTK_RANGE (shscale), GTK_UPDATE_CONTINUOUS); gtk_range_set_update_policy (GTK_RANGE (shscale), GTK_UPDATE_CONTINUOUS);
schanged_id = gtk_signal_connect (GTK_OBJECT (shscale), schanged_id = g_signal_connect (GTK_OBJECT (shscale),
"value_changed", G_CALLBACK (speed_cb), pipeline); "value_changed", G_CALLBACK (speed_cb), pipeline);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"button_press_event", G_CALLBACK (start_seek), pipeline); "button_press_event", G_CALLBACK (start_seek), pipeline);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"button_release_event", G_CALLBACK (stop_seek), pipeline); "button_release_event", G_CALLBACK (stop_seek), pipeline);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"format_value", G_CALLBACK (format_value), pipeline); "format_value", G_CALLBACK (format_value), pipeline);
/* do the packing stuff ... */ /* do the packing stuff ... */

View file

@ -1423,7 +1423,7 @@ start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
} }
if (changed_id == 0 && flush_seek && scrub) { if (changed_id == 0 && flush_seek && scrub) {
changed_id = gtk_signal_connect (GTK_OBJECT (hscale), changed_id = g_signal_connect (GTK_OBJECT (hscale),
"value_changed", G_CALLBACK (seek_cb), pipeline); "value_changed", G_CALLBACK (seek_cb), pipeline);
} }
@ -2552,7 +2552,6 @@ main (int argc, char **argv)
GtkWidget *accurate_checkbox, *key_checkbox, *loop_checkbox, *flush_checkbox; GtkWidget *accurate_checkbox, *key_checkbox, *loop_checkbox, *flush_checkbox;
GtkWidget *scrub_checkbox, *play_scrub_checkbox; GtkWidget *scrub_checkbox, *play_scrub_checkbox;
GtkWidget *rate_label, *volume_label; GtkWidget *rate_label, *volume_label;
GtkTooltips *tips;
GOptionEntry options[] = { GOptionEntry options[] = {
{"stats", 's', 0, G_OPTION_ARG_NONE, &stats, {"stats", 's', 0, G_OPTION_ARG_NONE, &stats,
"Show pad stats", NULL}, "Show pad stats", NULL},
@ -2612,7 +2611,6 @@ main (int argc, char **argv)
g_assert (pipeline); g_assert (pipeline);
/* initialize gui elements ... */ /* initialize gui elements ... */
tips = gtk_tooltips_new ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
video_window = gtk_drawing_area_new (); video_window = gtk_drawing_area_new ();
g_signal_connect (G_OBJECT (video_window), "expose-event", g_signal_connect (G_OBJECT (video_window), "expose-event",
@ -2643,23 +2641,18 @@ main (int argc, char **argv)
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (rate_spinbutton), 3); gtk_spin_button_set_digits (GTK_SPIN_BUTTON (rate_spinbutton), 3);
rate_label = gtk_label_new ("Rate"); rate_label = gtk_label_new ("Rate");
gtk_tooltips_set_tip (tips, accurate_checkbox, gtk_widget_set_tooltip_text (accurate_checkbox,
"accurate position is requested, this might be considerably slower for some formats", "accurate position is requested, this might be considerably slower for some formats");
NULL); gtk_widget_set_tooltip_text (key_checkbox,
gtk_tooltips_set_tip (tips, key_checkbox, "seek to the nearest keyframe. This might be faster but less accurate");
"seek to the nearest keyframe. This might be faster but less accurate", gtk_widget_set_tooltip_text (loop_checkbox, "loop playback");
NULL); gtk_widget_set_tooltip_text (flush_checkbox, "flush pipeline after seeking");
gtk_tooltips_set_tip (tips, loop_checkbox, "loop playback", NULL); gtk_widget_set_tooltip_text (rate_spinbutton, "define the playback rate, "
gtk_tooltips_set_tip (tips, flush_checkbox, "flush pipeline after seeking", "negative value trigger reverse playback");
NULL); gtk_widget_set_tooltip_text (scrub_checkbox, "show images while seeking");
gtk_tooltips_set_tip (tips, rate_spinbutton, "define the playback rate, " gtk_widget_set_tooltip_text (play_scrub_checkbox, "play video while seeking");
"negative value trigger reverse playback", NULL); gtk_widget_set_tooltip_text (skip_checkbox,
gtk_tooltips_set_tip (tips, scrub_checkbox, "show images while seeking", "Skip frames while playing at high frame rates");
NULL);
gtk_tooltips_set_tip (tips, play_scrub_checkbox, "play video while seeking",
NULL);
gtk_tooltips_set_tip (tips, skip_checkbox,
"Skip frames while playing at high frame rates", NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flush_checkbox), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flush_checkbox), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scrub_checkbox), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scrub_checkbox), TRUE);
@ -2733,11 +2726,11 @@ main (int argc, char **argv)
#endif #endif
gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS); gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"button_press_event", G_CALLBACK (start_seek), pipeline); "button_press_event", G_CALLBACK (start_seek), pipeline);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"button_release_event", G_CALLBACK (stop_seek), pipeline); "button_release_event", G_CALLBACK (stop_seek), pipeline);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"format_value", G_CALLBACK (format_value), pipeline); "format_value", G_CALLBACK (format_value), pipeline);
if (pipeline_type == 16) { if (pipeline_type == 16) {
@ -2795,8 +2788,8 @@ main (int argc, char **argv)
/* playbin2 panel for snapshot */ /* playbin2 panel for snapshot */
boxes2 = gtk_hbox_new (FALSE, 0); boxes2 = gtk_hbox_new (FALSE, 0);
shot_button = gtk_button_new_from_stock (GTK_STOCK_SAVE); shot_button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
gtk_tooltips_set_tip (tips, shot_button, gtk_widget_set_tooltip_text (shot_button,
"save a screenshot .png in the current directory", NULL); "save a screenshot .png in the current directory");
g_signal_connect (G_OBJECT (shot_button), "clicked", G_CALLBACK (shot_cb), g_signal_connect (G_OBJECT (shot_button), "clicked", G_CALLBACK (shot_cb),
pipeline); pipeline);
vis_combo = gtk_combo_box_new_text (); vis_combo = gtk_combo_box_new_text ();

View file

@ -152,7 +152,7 @@ static gboolean
start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data) start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
{ {
gst_element_set_state (pipeline, GST_STATE_PAUSED); gst_element_set_state (pipeline, GST_STATE_PAUSED);
gtk_timeout_remove (update_id); g_timeout_remove (update_id);
return FALSE; return FALSE;
} }
@ -181,7 +181,7 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
update_id = update_id =
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
return FALSE; return FALSE;
} }
@ -195,7 +195,7 @@ play_cb (GtkButton * button, gpointer data)
if (state != GST_STATE_PLAYING) { if (state != GST_STATE_PLAYING) {
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
update_id = update_id =
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
} }
} }
@ -207,7 +207,7 @@ pause_cb (GtkButton * button, gpointer data)
gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE); gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
if (state != GST_STATE_PAUSED) { if (state != GST_STATE_PAUSED) {
gst_element_set_state (pipeline, GST_STATE_PAUSED); gst_element_set_state (pipeline, GST_STATE_PAUSED);
gtk_timeout_remove (update_id); g_timeout_remove (update_id);
} }
} }
@ -219,7 +219,7 @@ stop_cb (GtkButton * button, gpointer data)
gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE); gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
if (state != GST_STATE_READY) { if (state != GST_STATE_READY) {
gst_element_set_state (pipeline, GST_STATE_READY); gst_element_set_state (pipeline, GST_STATE_READY);
gtk_timeout_remove (update_id); g_timeout_remove (update_id);
} }
} }
@ -256,11 +256,11 @@ main (int argc, char **argv)
gtk_scale_set_digits (GTK_SCALE (hscale), 2); gtk_scale_set_digits (GTK_SCALE (hscale), 2);
gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS); gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"button_press_event", G_CALLBACK (start_seek), pipeline); "button_press_event", G_CALLBACK (start_seek), pipeline);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"button_release_event", G_CALLBACK (stop_seek), pipeline); "button_release_event", G_CALLBACK (stop_seek), pipeline);
gtk_signal_connect (GTK_OBJECT (hscale), g_signal_connect (GTK_OBJECT (hscale),
"format_value", G_CALLBACK (format_value), pipeline); "format_value", G_CALLBACK (format_value), pipeline);
/* do the packing stuff ... */ /* do the packing stuff ... */