4
4
Index: gnomeradio-1.8/src/prefs.c
5
5
===================================================================
6
--- gnomeradio-1.8.orig/src/prefs.c 2013-09-10 21:07:38.591933000 +0000
7
+++ gnomeradio-1.8/src/prefs.c 2013-09-10 21:07:38.591933000 +0000
10
extern gnomeradio_settings settings;
11
extern gboolean main_visible;
12
+extern gboolean autodetect;
14
static GtkWidget *device_entry;
15
static GtkWidget *mixer_entry;
6
--- gnomeradio-1.8.orig/src/prefs.c 2013-09-15 02:32:10.044914103 +0000
7
+++ gnomeradio-1.8/src/prefs.c 2013-09-15 02:33:03.324912519 +0000
9
#include "rb_gst_media_types.h"
10
#include "rb_missing_plugins.h"
12
+extern int autodetect;
14
extern GtkWidget *preset_combo;
15
extern GtkAdjustment *adj;
19
20
/* Store general settings */
25
26
gconf_client_set_string(client, "/apps/gnomeradio/driver", settings.driver, NULL);
26
27
gconf_client_set_string(client, "/apps/gnomeradio/mixer", settings.mixer, NULL);
27
28
gconf_client_set_bool(client, "/apps/gnomeradio/mute-on-exit", settings.mute_on_exit, NULL);
29
30
/* Load general settings */
30
31
settings.device = gconf_client_get_string(client, "/apps/gnomeradio/device" , NULL);
31
32
if (!settings.device)
34
35
settings.driver = gconf_client_get_string(client, "/apps/gnomeradio/driver" , NULL);
35
36
if (!settings.driver)
36
37
settings.driver = g_strdup("any");
38
g_free(settings.device);
40
settings.device = g_strdup(text);
43
+ if (0 == strcmp(settings.device, "auto"))
46
start_radio(TRUE, data);
48
@@ -1182,7 +1190,10 @@
43
+device_entry_auto_activate_cb(GtkEntry* entry, const gchar* text, gpointer data)
45
+ GtkEditable *editable;
47
+ editable = GTK_EDITABLE (entry);
49
+ text = gtk_entry_get_text(GTK_ENTRY(device_entry));
52
+ if (0 == strcmp(text, "auto")) {
53
+ g_signal_emit_by_name(G_OBJECT (editable), "activate");
56
+ gtk_widget_grab_focus(add_button);
60
static gboolean mixer_entry_activate_cb(GtkWidget *widget, gpointer data)
63
@@ -1239,7 +1262,10 @@
49
64
gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1);
51
66
device_entry = gtk_entry_new();
52
67
- gtk_entry_set_text(GTK_ENTRY(device_entry), settings.device);
54
+ gtk_entry_set_text(GTK_ENTRY(device_entry), "auto");
69
+ gtk_entry_set_placeholder_text(GTK_ENTRY(device_entry), "auto");
56
71
+ gtk_entry_set_text(GTK_ENTRY(device_entry), settings.device);
57
72
gtk_grid_attach(GTK_GRID(grid), device_entry, 2, 1, 1, 1);
59
74
label = gtk_label_new (_("Mixer Source:"));
77
g_signal_connect(G_OBJECT(device_entry), "hide", G_CALLBACK(device_entry_activate_cb), app);
78
g_signal_connect(G_OBJECT(device_entry), "activate", G_CALLBACK(device_entry_activate_cb), NULL);
79
+ g_signal_connect(G_OBJECT(device_entry), "changed", G_CALLBACK(device_entry_auto_activate_cb), NULL);
80
g_signal_connect(G_OBJECT(mixer_entry), "hide", G_CALLBACK(mixer_entry_activate_cb), app);
81
g_signal_connect(G_OBJECT(mixer_entry), "activate", G_CALLBACK(mixer_entry_activate_cb), NULL);
82
g_signal_connect(G_OBJECT(mute_on_exit_cb), "toggled", G_CALLBACK(mute_on_exit_toggled_cb), NULL);
60
83
Index: gnomeradio-1.8/src/gui.c
61
84
===================================================================
62
--- gnomeradio-1.8.orig/src/gui.c 2013-09-10 21:07:38.591933000 +0000
63
+++ gnomeradio-1.8/src/gui.c 2013-09-10 21:10:10.634239077 +0000
65
gnomeradio_settings settings;
67
gboolean main_visible;
71
GtkWidget *preset_combo;
85
--- gnomeradio-1.8.orig/src/gui.c 2013-09-15 02:32:10.044914103 +0000
86
+++ gnomeradio-1.8/src/gui.c 2013-09-15 02:32:10.040914103 +0000
88
USB radio devices benefit from a larger default latency */
89
#define DEFAULT_LATENCY 500
93
int alsa_loopback = 1;
94
char *alsa_playback = NULL;
95
char *alsa_capture = NULL;
73
97
driver = DRIVER_V4L2;
77
+ if (0 == strcmp(settings.device, "auto")) {
78
+ radio_set_device(settings.device, AUTO);
101
+ if (0 == strcmp(settings.device, "auto"))
82
104
if (!radio_init(settings.device, driver)) {
83
105
- char *caption = g_strdup_printf(_("Could not open radio device \"%s\"!"), settings.device);
86
108
+ char *caption, *detail;
88
110
+ if (autodetect) {
89
+ caption = g_strdup_printf (_("Could not find an radio device to connect to!"));
90
+ detail = g_strdup_printf (_("Please ensure that you have a radio device connected.\n"
91
+ "Also make sure that the device is connected properly."));
111
+ caption = g_strdup_printf (_("Could not find any radio device!"));
112
+ detail = g_strdup_printf (_("Please ensure that you have a radio device connected to your computer.\n"
113
+ "You can also use the dmesg command: \"dmesg | grep radio\" to determine\n"
114
+ "whether device is properly detected."));
93
116
+ caption = g_strdup_printf (_("Could not open radio device \"%s\"!"), settings.device);
94
117
+ detail = g_strdup_printf (_("You can auto detect radio device by typing \"auto\" in device settings."));
126
149
#include "radio.h"
127
150
#include "v4l1.h"
152
#include "alsa_stream.h"
153
#include "get_media_devices.h"
155
+extern int autodetect;
157
extern int alsa_loopback;
158
extern char *alsa_playback;
159
extern char *alsa_capture;
130
162
* These functions handle the radio device
132
+void radio_set_device(char *device, DeviceMode mode)
137
+ void *md = discover_media_devices();
138
+ const char *p = NULL;
141
+ p = get_associated_device(md, p, MEDIA_V4L_RADIO, NULL, NONE);
144
+ snprintf(device, PATH_MAX, "/dev/%s", p);
147
+ free_media_devices(md);
155
165
int radio_init(char *device, DriverType driver)
157
Index: gnomeradio-1.8/src/radio.h
158
===================================================================
159
--- gnomeradio-1.8.orig/src/radio.h 2013-09-10 21:07:38.591933000 +0000
160
+++ gnomeradio-1.8/src/radio.h 2013-09-10 21:07:38.591933000 +0000
163
int radio_init(char *device, DriverType type);
165
+typedef enum _DeviceMode DeviceMode;
171
+void radio_set_device(char *device, DeviceMode mode);
173
int radio_is_init(void);
175
void radio_stop(void);
171
+ const char *p = NULL;
172
+ char buf[PATH_MAX];
175
+ md = discover_media_devices();
177
+ fprintf (stderr, "open: Failed to open \"auto\" device");
179
+ fprintf (stderr, " at %s\n", device);
181
+ fprintf (stderr, "\n");
186
+ p = get_associated_device(md, p, MEDIA_V4L_RADIO, NULL, NONE);
189
+ snprintf(buf, sizeof(buf), "/dev/%s", p);
193
+ free_media_devices(md);
200
dev = v4l1_radio_dev_new();
201
rv = dev->init (dev, device);
203
- fprintf(stderr, "Initializing v4l1 failed\n");
204
+ fprintf(stderr, "v4l1: Initialization failed\n");
207
if (driver != DRIVER_ANY)
209
dev = v4l2_radio_dev_new();
210
rv = dev->init (dev, device);
212
- fprintf(stderr, "Initializing v4l2 failed\n");
213
+ fprintf(stderr, "v4l2: Initialization failed\n");
216
if (driver != DRIVER_ANY)
222
+ fprintf(stderr, "open: Using radio device: %s\n", device);
228
if (alsa_capture == NULL) {
229
void *md = discover_media_devices();
176
230
Index: gnomeradio-1.8/data/gnomeradio.schemas.in
177
231
===================================================================
178
--- gnomeradio-1.8.orig/data/gnomeradio.schemas.in 2013-09-10 21:07:38.591933000 +0000
179
+++ gnomeradio-1.8/data/gnomeradio.schemas.in 2013-09-10 21:07:38.591933000 +0000
232
--- gnomeradio-1.8.orig/data/gnomeradio.schemas.in 2013-09-15 02:32:10.044914103 +0000
233
+++ gnomeradio-1.8/data/gnomeradio.schemas.in 2013-09-15 02:32:10.040914103 +0000
180
234
@@ -29,7 +29,7 @@
181
235
<applyto>/apps/gnomeradio/device</applyto>
182
236
<owner>gnomeradio</owner>