Mercurial > pidgin.yaz
changeset 26496:a820c03b9d4e
Get rid of the media tab in the preferences.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Fri, 03 Apr 2009 05:24:47 +0000 |
parents | a198f064a42c |
children | da3f44d6cd52 |
files | pidgin/gtkprefs.c |
diffstat | 1 files changed, 0 insertions(+), 334 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkprefs.c Fri Apr 03 05:02:57 2009 +0000 +++ b/pidgin/gtkprefs.c Fri Apr 03 05:24:47 2009 +0000 @@ -28,9 +28,6 @@ #include "pidgin.h" #include "debug.h" -#ifdef USE_VV -#include "mediamanager.h" -#endif #include "notify.h" #include "prefs.h" #include "proxy.h" @@ -57,10 +54,6 @@ #include "gtkutils.h" #include "pidginstock.h" -#ifdef USE_VV -#include <gst/interfaces/propertyprobe.h> -#endif - #define PROXYHOST 0 #define PROXYPORT 1 #define PROXYUSER 2 @@ -2406,317 +2399,6 @@ return ret; } -#ifdef USE_VV -static GList* -get_devices(const gchar *plugin) -{ - GObjectClass *klass; - GstPropertyProbe *probe; - const GParamSpec *pspec; - GstElement *element = gst_element_factory_make(plugin, NULL); - GstElementFactory *factory; - const gchar *longname = NULL; - GList *ret = NULL; - - if (element == NULL) - return NULL; - - factory = gst_element_get_factory(element); - - longname = gst_element_factory_get_longname(factory); - klass = G_OBJECT_GET_CLASS(element); - - if (!g_object_class_find_property(klass, "device") || - !GST_IS_PROPERTY_PROBE(element) || - !(probe = GST_PROPERTY_PROBE(element)) || - !(pspec = gst_property_probe_get_property(probe, - "device"))) { - purple_debug_info("media", - "Found source '%s' (%s) - no device\n", - longname, GST_PLUGIN_FEATURE (factory)->name); - } else { - gint n; - gchar *name; - GValueArray *array; - - purple_debug_info("media", "Found devices\n"); - - /* Set autoprobe[-fps] to FALSE to avoid delays when probing. */ - if (g_object_class_find_property (klass, "autoprobe")) { - g_object_set(G_OBJECT (element), - "autoprobe", FALSE, NULL); - if (g_object_class_find_property(klass, - "autoprobe-fps")) { - g_object_set(G_OBJECT(element), - "autoprobe-fps", FALSE, NULL); - } - } - - array = gst_property_probe_probe_and_get_values(probe, pspec); - if (array != NULL) { - for (n = 0 ; n < array->n_values ; n++) { - GValue *device = g_value_array_get_nth( - array, n); - - ret = g_list_append(ret, - g_value_dup_string(device)); - - g_object_set(G_OBJECT(element), "device", - g_value_get_string(device), - NULL); - g_object_get(G_OBJECT(element), - "device-name", &name, NULL); - purple_debug_info("media", "Found source '%s'" - " (%s) - device '%s' (%s)\n", - longname, GST_PLUGIN_FEATURE( - factory)->name, name, - g_value_get_string(device)); - g_free(name); - } - g_value_array_free(array); - } - - /* Restore autoprobe[-fps] to TRUE. */ - if (g_object_class_find_property(klass, "autoprobe")) { - g_object_set(G_OBJECT(element), - "autoprobe", TRUE, NULL); - if (g_object_class_find_property(klass, - "autoprobe-fps")) { - g_object_set(G_OBJECT(element), - "autoprobe-fps", TRUE, NULL); - } - } - } - - gst_object_unref(element); - return ret; -} - -/* get a GList of pairs name / device */ -static GList * -get_device_items(const gchar *plugin) -{ - GList *ret = NULL; - GList *devices = get_devices(plugin); - GstElement *element = gst_element_factory_make(plugin, NULL); - - if (element == NULL) - return NULL; - - for(; devices ; devices = g_list_delete_link(devices, devices)) { - gchar *name; - g_object_set(G_OBJECT(element), "device", devices->data, NULL); - g_object_get(G_OBJECT(element), "device-name", &name, NULL); - ret = g_list_append(ret, name); - ret = g_list_append(ret, devices->data); - } - - gst_object_unref(element); - return ret; -} - -/* - * Test functions to run video preview - */ -static gboolean -preview_video_bus_call(GstBus *bus, GstMessage *msg, gpointer pipeline) -{ - switch(GST_MESSAGE_TYPE(msg)) { - case GST_MESSAGE_EOS: - purple_debug_info("preview-video", "End of Stream\n"); - break; - case GST_MESSAGE_ERROR: { - gchar *debug = NULL; - GError *err = NULL; - - gst_message_parse_error(msg, &err, &debug); - - purple_debug_error("preview-video", "Error: %s\n", err->message); - g_error_free(err); - - if (debug) { - purple_debug_error("preview-video", "details: %s\n", debug); - g_free (debug); - } - break; - } - default: - return TRUE; - } - - gst_element_set_state(pipeline, GST_STATE_NULL); - gst_object_unref(GST_PIPELINE(pipeline)); - return FALSE; -} - -static void -preview_button_clicked(GtkWidget *widget, gpointer *data) -{ - const char *plugin = purple_prefs_get_string("/purple/media/video/plugin"); - const char *device = purple_prefs_get_string("/purple/media/video/device"); - GstBus *bus; - - /* create a preview window... */ - GstElement *pipeline = NULL; - GError *p_err = NULL; - - gchar *test_pipeline_str = NULL; - - if (strlen(device) > 0) - test_pipeline_str = g_strdup_printf("%s device=\"%s\" !" \ - " ffmpegcolorspace !" \ - " autovideosink", - plugin, device); - else - test_pipeline_str = g_strdup_printf("%s ! ffmpegcolorspace !" \ - " autovideosink", plugin); - - pipeline = gst_parse_launch (test_pipeline_str, &p_err); - - g_free(test_pipeline_str); - - if (pipeline == NULL) { - purple_debug_error("gtkprefs", - "Error starting preview: %s\n", p_err->message); - g_error_free(p_err); - return; - } - - bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); - gst_bus_add_watch(bus, preview_video_bus_call, pipeline); - gst_object_unref(bus); - - gst_element_set_state(pipeline, GST_STATE_PLAYING); -} - -static void -media_plugin_changed_cb(const gchar *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - GtkWidget *hbox = data; - GtkWidget *dd = NULL; - GtkWidget *preview_button = NULL; - const char *plugin = value; - const char *device = purple_prefs_get_string("/purple/media/video/device"); - GList *video_items = get_device_items(plugin); - GList *list; - - if (video_items == NULL) { - video_items = g_list_prepend(video_items, g_strdup("")); - video_items = g_list_prepend(video_items, g_strdup("Default")); - } - - if (g_list_find(video_items, device) == NULL) - { - purple_prefs_set_string("/purple/media/video/device", - g_list_next(video_items)->data); - } - - list = gtk_container_get_children(GTK_CONTAINER(hbox)); - - while (list) { - gtk_widget_destroy(list->data); - list = g_list_delete_link(list, list); - } - - dd = pidgin_prefs_dropdown_from_list(hbox, _("_Device:"), PURPLE_PREF_STRING, - "/purple/media/video/device", - video_items); - - gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); - - preview_button = gtk_button_new_with_mnemonic(_("_Preview")); - g_signal_connect(G_OBJECT(preview_button), "clicked", - G_CALLBACK(preview_button_clicked), NULL); - - gtk_container_add(GTK_CONTAINER(hbox), preview_button); - - gtk_widget_show_all(hbox); -} - -static GtkWidget * -media_page() -{ - GtkWidget *ret; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *dd; - GtkWidget *preview_button; - GtkWidget *sw; - GtkSizeGroup *sg, *sg2; - const char *plugin = purple_prefs_get_string("/purple/media/video/plugin"); - const char *device = purple_prefs_get_string("/purple/media/video/device"); - GList *video_items = get_device_items(plugin); - GList *audio_items = get_device_items("alsasrc"); - - if (video_items == NULL) { - video_items = g_list_prepend(video_items, ""); - video_items = g_list_prepend(video_items, "Default"); - } - - if (g_list_find(video_items, device) == NULL) - { - purple_prefs_set_string("/purple/media/video/device", - g_list_next(video_items)->data); - } - - ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); - gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); - - sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - sg2 = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - - vbox = pidgin_make_frame (ret, _("Video Input")); - gtk_size_group_add_widget(sg2, vbox); - - hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); - dd = pidgin_prefs_dropdown(vbox, _("_Plugin:"), PURPLE_PREF_STRING, - "/purple/media/video/plugin", - _("Default"), "gconfvideosrc", - _("Video4Linux"), "v4lsrc", - _("Video4Linux2"), "v4l2src", - _("Video Test Source"), "videotestsrc", - NULL); - - gtk_size_group_add_widget(sg, dd); - gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); - - hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); - dd = pidgin_prefs_dropdown_from_list(hbox, _("Device:"), PURPLE_PREF_STRING, - "/purple/media/video/device", - video_items); - - purple_prefs_connect_callback(prefs, "/purple/media/video/plugin", - media_plugin_changed_cb, hbox); - - g_signal_connect_swapped(hbox, "destroy", - G_CALLBACK(purple_prefs_disconnect_by_handle), hbox); - - gtk_size_group_add_widget(sg, dd); - gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); - - preview_button = gtk_button_new_with_mnemonic(_("_Preview")); - g_signal_connect(G_OBJECT(preview_button), "clicked", - G_CALLBACK(preview_button_clicked), NULL); - - gtk_container_add(GTK_CONTAINER(hbox), preview_button); - gtk_container_add(GTK_CONTAINER(vbox), hbox); - - vbox = pidgin_make_frame (ret, _("Audio Input")); - gtk_size_group_add_widget(sg2, vbox); - dd = pidgin_prefs_dropdown_from_list(vbox, _("Device:"), PURPLE_PREF_STRING, - "/purple/media/audio/device", - audio_items); - - gtk_size_group_add_widget(sg, dd); - gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); - - gtk_widget_show_all(ret); - - return ret; -} - -#endif /* USE_VV */ static void set_idle_away(PurpleSavedStatus *status) @@ -2839,10 +2521,6 @@ prefs_notebook_add_page(_("Conversations"), conv_page(), notebook_page++); prefs_notebook_add_page(_("Smiley Themes"), theme_page(), notebook_page++); prefs_notebook_add_page(_("Sounds"), sound_page(), notebook_page++); - -#ifdef USE_VV - prefs_notebook_add_page(_("Media"), media_page(), notebook_page++); -#endif prefs_notebook_add_page(_("Network"), network_page(), notebook_page++); #ifndef _WIN32 /* We use the registered default browser in windows */ @@ -2979,18 +2657,6 @@ purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/smileys/theme", smiley_theme_pref_cb, NULL); -#ifdef USE_VV - purple_prefs_add_none("/purple/media"); - purple_prefs_add_none("/purple/media/video"); - purple_prefs_add_string("/purple/media/video/plugin", "gconfvideosrc"); - purple_prefs_add_string("/purple/media/video/device", ""); - purple_prefs_add_none("/purple/media/audio"); - purple_prefs_add_string("/purple/media/audio/device", ""); - purple_prefs_add_none("/purple/media/audio/volume"); - purple_prefs_add_int("/purple/media/audio/volume/input", 10); - purple_prefs_add_int("/purple/media/audio/volume/output", 10); -#endif /* USE_VV */ - pidgin_prefs_update_old(); }