35
35
static void get_profiles() {
36
36
GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(g_profiles));
37
gtk_list_store_clear(GTK_LIST_STORE(store));
37
gtk_list_store_clear(GTK_LIST_STORE(store));
39
39
media_profiles_load();
41
41
GList *list = profiles_get_list();
43
43
GList *item = g_list_first(list);
45
45
ProfileRec *rec = (ProfileRec*)item->data;
47
47
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(g_profiles), rec->id, rec->id);
49
49
LOG_DEBUG("Loading media profile: %s\n", rec->id);
51
51
item = g_list_next(item);
55
55
static void populate_fields(gchar *profile_name) {
57
57
gtk_entry_set_text(GTK_ENTRY(g_saved_id), "");
58
58
gtk_entry_set_text(GTK_ENTRY(g_file_ext), "");
60
GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(g_pipe_text));
60
GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(g_pipe_text));
61
61
gtk_text_buffer_set_text(buf, "", -1);
63
63
const ProfileRec *rec = profiles_find_rec(profile_name);
68
68
// Save current selection in g_saved_id
69
69
gtk_entry_set_text(GTK_ENTRY(g_saved_id), rec->id);
82
82
*file_ext = g_strdup(gtk_entry_get_text(GTK_ENTRY(g_file_ext)));
84
GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(g_pipe_text));
84
GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(g_pipe_text));
86
86
GtkTextIter start_t, end_t;
87
87
gtk_text_buffer_get_start_iter(buf, &start_t);
88
gtk_text_buffer_get_end_iter(buf, &end_t);
88
gtk_text_buffer_get_end_iter(buf, &end_t);
90
90
*pipe_text = gtk_text_buffer_get_text(buf, &start_t, &end_t, FALSE);
132
132
gboolean ret = gtk_tree_model_get_iter_first(model, iter);
135
135
gchar *name = NULL;
136
136
gtk_tree_model_get(GTK_TREE_MODEL(model), iter, 0, &name, -1);
138
138
if (!g_strcmp0(find_name, name)) {
145
145
ret = gtk_tree_model_iter_next(model, iter);
151
151
static void new_profile() {
152
152
populate_fields("");
154
GtkWidget *entry = gtk_bin_get_child(GTK_BIN(g_profiles));
154
GtkWidget *entry = gtk_bin_get_child(GTK_BIN(g_profiles));
155
155
gtk_entry_set_text(GTK_ENTRY(entry), "");
157
157
LOG_DEBUG("Create a new profile.\n");
159
gtk_widget_grab_focus(g_profiles);
159
gtk_widget_grab_focus(g_profiles);
162
162
static void delete_profile() {
163
163
gchar *old_name = NULL;
164
164
gchar *name = NULL;
165
165
gchar *file_ext = NULL;
166
gchar *pipe_text = NULL;
166
gchar *pipe_text = NULL;
167
167
read_fields(&old_name, &name, &file_ext, &pipe_text);
169
const gchar *str = NULL;
169
const gchar *str = NULL;
171
171
if (str_length0(old_name) > 0) {
177
profiles_delete(str);
177
profiles_delete(str);
179
179
populate_fields("");
183
183
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(g_profiles), NULL);
185
GtkWidget *entry = gtk_bin_get_child(GTK_BIN(g_profiles));
186
gtk_entry_set_text(GTK_ENTRY(entry), "");
185
GtkWidget *entry = gtk_bin_get_child(GTK_BIN(g_profiles));
186
gtk_entry_set_text(GTK_ENTRY(entry), "");
188
188
g_free(old_name);
323
323
gchar *s3 = g_strdup_printf(_("# This command will record to %s file."), parms->filename);
325
325
gchar *tmp_str = g_strdup_printf("%s\n%s\n%s\n\n", s1, s2, s3);
327
327
str = g_string_prepend(str, tmp_str);
332
gchar *cmd = g_string_free(str, FALSE);
332
gchar *cmd = g_string_free(str, FALSE);
334
334
// Show gst_launch command in a dialog
335
335
show_cmd_dialog(cmd);
337
337
g_free(old_name);
340
340
g_free(pipe_text);
344
344
pipeline_free_parms(parms);
348
348
static void show_cmd_clicked(GtkButton *button, gpointer user_data) {
349
show_recording_command();
349
show_recording_command();
352
352
static void reset_clicked(GtkButton *button, gpointer user_data) {
356
356
static void new_clicked(GtkButton *button, gpointer user_data) {
360
360
static void delete_clicked(GtkButton *button, gpointer user_data) {
364
364
static void save_clicked(GtkButton *button, gpointer user_data) {
368
368
GtkWidget *page_to_edit_pipelines() {
370
370
GtkWidget *vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 3);
373
373
// Ref: http://developer.gnome.org/gtk3/3.3/GtkGrid.html
374
374
GtkWidget *grid2 = gtk_grid_new();
376
376
gtk_grid_set_column_homogeneous(GTK_GRID(grid2), TRUE);
377
377
gtk_grid_set_column_spacing(GTK_GRID(grid2), 1);
390
390
g_profiles = gtk_combo_box_text_new_with_entry();
391
391
g_signal_connect(g_profiles, "changed", G_CALLBACK(title_changed), NULL);
392
392
gtk_grid_attach_next_to(GTK_GRID(grid2), g_profiles, label0, GTK_POS_RIGHT, 3, 1);
394
394
// Hidden field to hold selected g_profiles entry
395
395
g_saved_id = gtk_entry_new();
396
gtk_widget_hide(g_saved_id);
396
gtk_widget_hide(g_saved_id);
398
398
// File extension.
400
400
// Translators: This is a GUI label. Keep it short.
401
401
label0 = gtk_label_new(_("File extension:"));
402
402
gtk_widget_set_halign(label0, GTK_ALIGN_START);
413
413
gtk_grid_attach(GTK_GRID(grid2), label0, 0, 2, 1, 1);
415
415
g_pipe_text = gtk_text_view_new();
417
417
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(g_pipe_text), GTK_WRAP_WORD);
419
419
gtk_box_pack_start(GTK_BOX(vbox2), g_pipe_text, TRUE, TRUE, 0);
421
421
GtkWidget *vbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3);
427
427
// Translators: Button label in Additional settings -> Recording commands.
428
428
GtkWidget *button0 = gtk_button_new_with_label(_("Show cmd"));
429
g_signal_connect(button0, "clicked", G_CALLBACK(show_cmd_clicked), NULL);
429
g_signal_connect(button0, "clicked", G_CALLBACK(show_cmd_clicked), NULL);
430
430
gtk_box_pack_start(GTK_BOX(box0), button0, TRUE, FALSE, 0);
432
432
// Translators: Button label in Additional settings -> Recording commands.
433
433
button0 = gtk_button_new_with_label(_("Reset"));
434
g_signal_connect(button0, "clicked", G_CALLBACK(reset_clicked), NULL);
434
g_signal_connect(button0, "clicked", G_CALLBACK(reset_clicked), NULL);
435
435
gtk_box_pack_start(GTK_BOX(box0), button0, TRUE, FALSE, 0);
437
437
gtk_box_pack_start(GTK_BOX(vbox3), box0, FALSE, FALSE, 0);
439
439
box0 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
440
440
gtk_widget_show(box0);
442
442
gtk_button_box_set_layout(GTK_BUTTON_BOX(box0), GTK_BUTTONBOX_END);
444
444
// Translators: Button label in Additional settings -> Recording commands.
445
445
button0 = gtk_button_new_with_label(_("New"));
446
g_signal_connect(button0, "clicked", G_CALLBACK(new_clicked), NULL);
446
g_signal_connect(button0, "clicked", G_CALLBACK(new_clicked), NULL);
447
447
gtk_box_pack_start(GTK_BOX(box0), button0, TRUE, FALSE, 0);
449
449
// Translators: Button label in Additional settings -> Recording commands.
450
450
button0 = gtk_button_new_with_label(_("Delete"));
451
g_signal_connect(button0, "clicked", G_CALLBACK(delete_clicked), NULL);
451
g_signal_connect(button0, "clicked", G_CALLBACK(delete_clicked), NULL);
452
452
gtk_box_pack_start(GTK_BOX(box0), button0, TRUE, FALSE, 0);
454
454
// Translators: Button label in Additional settings -> Recording commands.
455
455
button0 = gtk_button_new_with_label(_("Save"));
456
g_signal_connect(button0, "clicked", G_CALLBACK(save_clicked), NULL);
456
g_signal_connect(button0, "clicked", G_CALLBACK(save_clicked), NULL);
457
457
gtk_box_pack_start(GTK_BOX(box0), button0, TRUE, FALSE, 0);
459
459
gtk_box_pack_end(GTK_BOX(vbox3), box0, FALSE, FALSE, 0);
461
461
gtk_box_pack_start(GTK_BOX(vbox2), vbox3, FALSE, TRUE, 0);
463
463
// Fill text combo with profiles names/titles