static void new_profile_response_callback (GtkWidget *new_profile_dialog, int response_id, GMAudioProfilesEdit *dialog) { if (response_id == GTK_RESPONSE_ACCEPT) { GtkWidget *name_entry; char *name; char *id; /*GtkWidget *base_option_menu;*/ GMAudioProfile *new_profile; GList *profiles; GList *tmp; GtkWindow *transient_parent; GError *error; name_entry = g_object_get_data (G_OBJECT (new_profile_dialog), "name_entry"); name = gtk_editable_get_chars (GTK_EDITABLE (name_entry), 0, -1); g_strstrip (name); /* name will be non empty after stripping */ profiles = gm_audio_profile_get_list (); for (tmp = profiles; tmp != NULL; tmp = tmp->next) { GMAudioProfile *profile = tmp->data; if (strcmp (name, gm_audio_profile_get_name (profile)) == 0) break; } if (tmp) { gmp_util_run_error_dialog (GTK_WINDOW (new_profile_dialog), _("You already have a profile called \"%s\""), name); goto cleanup; } g_list_free (profiles); /* base_option_menu = g_object_get_data (G_OBJECT (new_profile_dialog), "base_option_menu"); base_profile = profile_optionmenu_get_selected (base_option_menu); if (base_profile == NULL) { terminal_util_show_error_dialog (GTK_WINDOW (new_profile_dialog), NULL, _("The profile you selected as a base for your new profile no longer exists")); goto cleanup; } */ transient_parent = gtk_window_get_transient_for (GTK_WINDOW (new_profile_dialog)); error = NULL; id = gm_audio_profile_create (name, dialog->priv->conf, &error); if (error) { g_print ("ERROR: %s\n", error->message); gmp_util_run_error_dialog (GTK_WINDOW (transient_parent), _("MateConf Error (FIXME): %s\n"), error->message); g_error_free (error); goto cleanup; } gtk_widget_destroy (new_profile_dialog); /* FIXME: hm, not very proud of having to unstatic this function */ GST_DEBUG ("new profile callback: syncing list\n"); //FIXME: in mate-terminal, it's TRUE, &n, which then gets overruled // by some other sync call with the new list //audio_profile_sync_list (TRUE, &n); gm_audio_profile_sync_list (FALSE, NULL); refill_profile_treeview (dialog->priv->manage_profiles_list); new_profile = gm_audio_profile_lookup (id); g_assert (new_profile != NULL); //audio_profile_edit (new_profile, transient_parent); cleanup: g_free (name); } else { gtk_widget_destroy (new_profile_dialog); } GST_DEBUG ("done creating new profile\n"); }
Recording* recording_start(const char* filename) { GMAudioProfile *profile; GstElement *pipeline, *oss_src, *encoder, *filesink; pipeline = oss_src = encoder = filesink = NULL; profile = gm_audio_profile_lookup(rec_settings.profile); g_assert(profile); pipeline = gst_pipeline_new("gnomeradio-record-pipeline"); if (!pipeline) { show_error_message(_("Could not create GStreamer pipeline."), _("Check your Gstreamer installation!")); goto error; } oss_src = gst_element_factory_make("osssrc", "oss-source"); if (!oss_src) { show_error_message(_("Could not open Gstreamer OSS Source."), _("Verify your Gstreamer OSS subsystem installation!")); goto error; } GstBus *bus = gst_element_get_bus(pipeline); gst_bus_add_signal_watch(bus); g_signal_connect(G_OBJECT(bus), "message::error", G_CALLBACK(error_cb), pipeline); char* pipeline_str = g_strdup_printf("audioconvert ! %s", gm_audio_profile_get_pipeline(profile)); encoder = my_gst_gconf_render_bin_from_description(pipeline_str); g_free(pipeline_str); if (!encoder) { char *caption = g_strdup_printf(_("Could not create encoder \"%s\"."), gm_audio_profile_get_name (profile)); show_error_message(caption, _("Verify your Gstreamer plugins installation!")); g_free(caption); goto error; } /* Write to disk */ filesink = gst_element_factory_make("filesink", "file-sink"); if (!filesink) { show_error_message(_("Could not create Gstreamer filesink."), _("Check your Gstreamer installation!")); goto error; } /* Add the elements to the pipeline */ gst_bin_add_many(GST_BIN(pipeline), oss_src, encoder, filesink, NULL); /* Link it all together */ if (!gst_element_link_many(oss_src, encoder, filesink, NULL)) { g_warning("Could not link elements. This is bad!\n"); goto error; } char* path = g_strdup_printf("%s.%s", filename, gm_audio_profile_get_extension(profile)); g_object_set(G_OBJECT(filesink), "location", path, NULL); gst_element_set_state(pipeline, GST_STATE_PLAYING); Recording *recording = g_malloc0(sizeof(Recording)); recording->filename = path; recording->pipeline = pipeline; return recording; error: if (pipeline) gst_object_unref(GST_OBJECT(pipeline)); if (oss_src) gst_object_unref(GST_OBJECT(oss_src)); if (encoder) gst_object_unref(GST_OBJECT(encoder)); if (filesink) gst_object_unref(GST_OBJECT(filesink)); return NULL; }