examples: update some more code for new Gtk+ API, with fallback for older Gtk+ versions

Move code to new Gtk+ 3.x / 2.9x API. We have defines in place
already that make this code work fine on older Gtk+ 2.x.

https://bugzilla.gnome.org/show_bug.cgi?id=632653
This commit is contained in:
Matthias Clasen 2010-10-30 16:03:18 +01:00 committed by Tim-Philipp Müller
parent 9f9e5f80aa
commit bb7e76e889
2 changed files with 22 additions and 22 deletions

View file

@ -1795,11 +1795,11 @@ clear_streams (GstElement * pipeline)
/* remove previous info */
for (i = 0; i < n_video; i++)
gtk_combo_box_remove_text (GTK_COMBO_BOX (video_combo), 0);
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (video_combo), 0);
for (i = 0; i < n_audio; i++)
gtk_combo_box_remove_text (GTK_COMBO_BOX (audio_combo), 0);
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (audio_combo), 0);
for (i = 0; i < n_text; i++)
gtk_combo_box_remove_text (GTK_COMBO_BOX (text_combo), 0);
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (text_combo), 0);
n_audio = n_video = n_text = 0;
gtk_widget_set_sensitive (video_combo, FALSE);
@ -1840,7 +1840,7 @@ update_streams (GstPipeline * pipeline)
}
/* find good name for the label */
name = g_strdup_printf ("video %d", i + 1);
gtk_combo_box_append_text (GTK_COMBO_BOX (video_combo), name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (video_combo), name);
g_free (name);
}
state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (video_checkbox));
@ -1857,7 +1857,7 @@ update_streams (GstPipeline * pipeline)
}
/* find good name for the label */
name = g_strdup_printf ("audio %d", i + 1);
gtk_combo_box_append_text (GTK_COMBO_BOX (audio_combo), name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (audio_combo), name);
g_free (name);
}
state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (audio_checkbox));
@ -1886,7 +1886,7 @@ update_streams (GstPipeline * pipeline)
if (name == NULL)
name = g_strdup_printf ("text %d", i + 1);
gtk_combo_box_append_text (GTK_COMBO_BOX (text_combo), name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (text_combo), name);
g_free (name);
}
state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (text_checkbox));
@ -1962,7 +1962,7 @@ init_visualization_features (void)
name = gst_element_factory_get_longname (entry.factory);
g_array_append_val (vis_entries, entry);
gtk_combo_box_append_text (GTK_COMBO_BOX (vis_combo), name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (vis_combo), name);
}
gtk_combo_box_set_active (GTK_COMBO_BOX (vis_combo), 0);
}
@ -2873,9 +2873,9 @@ main (int argc, char **argv)
if (pipeline_type == 16) {
/* the playbin2 panel controls for the video/audio/subtitle tracks */
panel = gtk_hbox_new (FALSE, 0);
video_combo = gtk_combo_box_new_text ();
audio_combo = gtk_combo_box_new_text ();
text_combo = gtk_combo_box_new_text ();
video_combo = gtk_combo_box_text_new ();
audio_combo = gtk_combo_box_text_new ();
text_combo = gtk_combo_box_text_new ();
gtk_widget_set_sensitive (video_combo, FALSE);
gtk_widget_set_sensitive (audio_combo, FALSE);
gtk_widget_set_sensitive (text_combo, FALSE);
@ -2939,7 +2939,7 @@ main (int argc, char **argv)
"save a screenshot .png in the current directory");
g_signal_connect (G_OBJECT (shot_button), "clicked", G_CALLBACK (shot_cb),
pipeline);
vis_combo = gtk_combo_box_new_text ();
vis_combo = gtk_combo_box_text_new ();
g_signal_connect (G_OBJECT (vis_combo), "changed",
G_CALLBACK (vis_combo_cb), pipeline);
gtk_widget_set_sensitive (vis_combo, FALSE);

View file

@ -1785,11 +1785,11 @@ clear_streams (GstElement * pipeline)
/* remove previous info */
for (i = 0; i < n_video; i++)
gtk_combo_box_remove_text (GTK_COMBO_BOX (video_combo), 0);
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (video_combo), 0);
for (i = 0; i < n_audio; i++)
gtk_combo_box_remove_text (GTK_COMBO_BOX (audio_combo), 0);
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (audio_combo), 0);
for (i = 0; i < n_text; i++)
gtk_combo_box_remove_text (GTK_COMBO_BOX (text_combo), 0);
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (text_combo), 0);
n_audio = n_video = n_text = 0;
gtk_widget_set_sensitive (video_combo, FALSE);
@ -1830,7 +1830,7 @@ update_streams (GstPipeline * pipeline)
}
/* find good name for the label */
name = g_strdup_printf ("video %d", i + 1);
gtk_combo_box_append_text (GTK_COMBO_BOX (video_combo), name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (video_combo), name);
g_free (name);
}
state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (video_checkbox));
@ -1847,7 +1847,7 @@ update_streams (GstPipeline * pipeline)
}
/* find good name for the label */
name = g_strdup_printf ("audio %d", i + 1);
gtk_combo_box_append_text (GTK_COMBO_BOX (audio_combo), name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (audio_combo), name);
g_free (name);
}
state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (audio_checkbox));
@ -1876,7 +1876,7 @@ update_streams (GstPipeline * pipeline)
if (name == NULL)
name = g_strdup_printf ("text %d", i + 1);
gtk_combo_box_append_text (GTK_COMBO_BOX (text_combo), name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (text_combo), name);
g_free (name);
}
state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (text_checkbox));
@ -1952,7 +1952,7 @@ init_visualization_features (void)
name = gst_element_factory_get_longname (entry.factory);
g_array_append_val (vis_entries, entry);
gtk_combo_box_append_text (GTK_COMBO_BOX (vis_combo), name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (vis_combo), name);
}
gtk_combo_box_set_active (GTK_COMBO_BOX (vis_combo), 0);
}
@ -2818,9 +2818,9 @@ main (int argc, char **argv)
if (pipeline_type == 16) {
/* the playbin2 panel controls for the video/audio/subtitle tracks */
panel = gtk_hbox_new (FALSE, 0);
video_combo = gtk_combo_box_new_text ();
audio_combo = gtk_combo_box_new_text ();
text_combo = gtk_combo_box_new_text ();
video_combo = gtk_combo_box_text_new ();
audio_combo = gtk_combo_box_text_new ();
text_combo = gtk_combo_box_text_new ();
gtk_widget_set_sensitive (video_combo, FALSE);
gtk_widget_set_sensitive (audio_combo, FALSE);
gtk_widget_set_sensitive (text_combo, FALSE);
@ -2884,7 +2884,7 @@ main (int argc, char **argv)
"save a screenshot .png in the current directory");
g_signal_connect (G_OBJECT (shot_button), "clicked", G_CALLBACK (shot_cb),
pipeline);
vis_combo = gtk_combo_box_new_text ();
vis_combo = gtk_combo_box_text_new ();
g_signal_connect (G_OBJECT (vis_combo), "changed",
G_CALLBACK (vis_combo_cb), pipeline);
gtk_widget_set_sensitive (vis_combo, FALSE);