89
91
startup_teletext(void)
91
93
#ifdef HAVE_LIBZVBI
92
if (_teletext_view_new /* have Teletext plugin */)
94
if (NULL == _teletext_view_new /* have Teletext plugin */)
95
gtk_action_group_set_visible (zapping->teletext_action_group, FALSE);
96
if (NULL == _subtitle_view_new /* have Subtitle plugin */)
97
gtk_action_group_set_visible (zapping->subtitle_action_group, FALSE);
101
/* XXX still useful for channel names et al. */
102
if (_teletext_view_new || _subtitle_view_new)
94
/* Make the vbi module open the device */
96
zconf_touch("/zapping/options/vbi/enable_vbi");
111
gtk_action_group_set_visible (zapping->teletext_action_group, FALSE);
112
gtk_action_group_set_visible (zapping->subtitle_action_group, FALSE);
114
printv ("VBI disabled, removing GUI items\n");
116
/* Set the capture mode to a default value and disable VBI */
117
if (zcg_int (NULL, "capture_mode") == OLD_TVENG_TELETEXT)
118
zcs_int (OLD_TVENG_CAPTURE_READ, "capture_mode");
103
vbi_gui_sensitive(FALSE);
108
Called 0.5s after the main window is created, should solve all the
109
problems with geometry restoring.
111
XXX replace by session management
114
gint resize_timeout ( gpointer ignored _unused_)
116
gint x, y, w, h; /* Saved geometry */
118
zconf_get_int (&x, "/zapping/internal/callbacks/x");
119
zconf_get_int (&y, "/zapping/internal/callbacks/y");
120
zconf_get_int (&w, "/zapping/internal/callbacks/w");
121
zconf_get_int (&h, "/zapping/internal/callbacks/h");
123
printv("Restoring geometry: <%d,%d> <%d x %d>\n", x, y, w, h);
125
if (w == 0 || h == 0)
127
gdk_window_resize(GTK_WIDGET (zapping)->window, 320, 200);
131
gdk_window_move_resize(GTK_WIDGET (zapping)->window, x, y, w, h);
123
session_save (GnomeClient * client,
125
GnomeSaveStyle save_style,
126
gboolean shutting_down,
127
GnomeInteractStyle interact_style,
137
save_style = save_style;
138
shutting_down = shutting_down;
139
interact_style = interact_style;
142
argv = g_malloc0 (4 * sizeof (gchar *));
145
argv[argc++] = user_data; /* main() argv[0] */
147
gnome_client_set_clone_command (client, argc, argv);
148
gnome_client_set_restart_command (client, argc, argv);
152
for (p = g_list_first (plugin_list); p; p = p->next)
154
struct plugin_info *pi;
156
/* Shutdown while recording etc no good. */
157
pi = (struct plugin_info *) p->data;
158
success &= plugin_running (pi);
161
/* libgnomeui 2.8 bug: ignores return value. */
162
client->save_successfull = success;
168
session_die (GnomeClient * client,
172
user_data = user_data;
174
on_python_command1 (GTK_WIDGET (zapping), "zapping.quit()");
137
177
#include "pixmaps/brightness.h"
216
260
zconf_get_sources (zapping->info, start_muted);
263
#define DEVICE_SUPPORTS_CAPTURE(info) \
264
(0 != (tv_get_caps (info)->flags & TVENG_CAPS_CAPTURE))
265
#define DEVICE_SUPPORTS_OVERLAY(info) \
266
(0 != (tv_get_caps (info)->flags & TVENG_CAPS_OVERLAY))
220
269
restore_last_capture_mode (void)
222
/* Start the capture in the last mode */
226
if (-1 == zmisc_switch_mode (DISPLAY_MODE_WINDOW,
229
ShowBox (_("Capture mode couldn't be started:\n%s"),
230
GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
237
from_old_tveng_capture_mode (&dmode, &cmode,
238
(enum old_tveng_capture_mode)
239
zcg_int (NULL, "capture_mode"));
241
if (-1 == zmisc_switch_mode (dmode, cmode, zapping->info))
243
if (CAPTURE_MODE_READ != cmode)
246
ShowBox(_("Cannot restore previous mode, will try capture mode:\n%s"),
247
GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
249
if (-1 == zmisc_switch_mode (DISPLAY_MODE_WINDOW,
250
CAPTURE_MODE_READ, zapping->info))
253
ShowBox(_("Capture mode couldn't be started either:\n%s"),
254
GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
256
ShowBox(_("Cannot restore previous mode:\n%s"),
257
GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
262
ShowBox (_("Capture mode couldn't be started:\n%s"),
263
GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
268
last_dmode = DISPLAY_MODE_WINDOW;
269
last_cmode = CAPTURE_MODE_OVERLAY;
276
cap_mode = zcg_int (NULL, "capture_mode");
277
from_old_tveng_capture_mode (&dmode, &cmode,
278
(enum old_tveng_capture_mode) cap_mode);
282
if (CAPTURE_MODE_NONE == cmode)
283
cmode = CAPTURE_MODE_OVERLAY;
285
if (!DEVICE_SUPPORTS_CAPTURE (zapping->info))
289
printv("Device not capture capable, removing GUI items\n");
290
action = gtk_action_group_get_action (zapping->generic_action_group,
292
z_action_set_sensitive (action, FALSE);
294
if (CAPTURE_MODE_READ == cmode)
295
cmode = CAPTURE_MODE_OVERLAY;
298
if (disable_overlay || !DEVICE_SUPPORTS_OVERLAY (zapping->info))
302
printv("Device not overlay capable, removing GUI items\n");
303
action = gtk_action_group_get_action (zapping->generic_action_group,
305
z_action_set_sensitive (action, FALSE);
307
if (CAPTURE_MODE_OVERLAY == cmode)
309
if (!DEVICE_SUPPORTS_CAPTURE (zapping->info))
312
cmode = CAPTURE_MODE_READ;
316
if (0 == zmisc_switch_mode (dmode, cmode, zapping->info,
317
/* warnings */ FALSE))
320
errstr = g_strdup (tv_get_errstr (zapping->info));
322
dmode = DISPLAY_MODE_WINDOW;
324
if (CAPTURE_MODE_READ == cmode)
326
if (disable_overlay || !DEVICE_SUPPORTS_OVERLAY (zapping->info))
329
cmode = CAPTURE_MODE_OVERLAY;
331
else if (CAPTURE_MODE_OVERLAY == cmode)
333
if (!DEVICE_SUPPORTS_CAPTURE (zapping->info))
336
cmode = CAPTURE_MODE_READ;
339
ShowBox(_("Cannot restore previous mode, will try capture mode:\n%s"),
340
GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
343
if (0 == zmisc_switch_mode (dmode, cmode, zapping->info,
344
/* warnings */ FALSE))
348
ShowBox(_("Capture mode couldn't be started either:\n%s"),
349
GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
352
ShowBox(_("Cannot restore previous mode:\n%s"),
353
GTK_MESSAGE_ERROR, errstr);
356
last_dmode = DISPLAY_MODE_WINDOW;
357
last_cmode = CAPTURE_MODE_OVERLAY;
275
372
extern int zapzilla_main(int argc, char * argv[]);
277
int main(int argc, char * argv[])
374
/* Make sure the version appears in backtraces. */
375
#define _MAIN(version) main_ ## version
376
#define MAIN(version) _MAIN (version)
379
MAIN (PACKAGE_VERSION_ID) (int argc,
383
MAIN (PACKAGE_VERSION_ID) (int argc,
926
gtk_widget_show(GTK_WIDGET (zapping));
928
1073
printv("switching to mode %d (%d)\n",
929
1074
zcg_int (NULL, "capture_mode"), OLD_TVENG_CAPTURE_READ);
931
resize_timeout(NULL);
932
/* Sets the coords to the previous values, if the users wants to */
933
if (zcg_bool(NULL, "keep_geometry"))
934
g_timeout_add (500, (GSourceFunc) resize_timeout, NULL);
936
1076
restore_last_capture_mode ();
1078
printv("session manager\n");
1079
g_signal_connect (session, "save-yourself",
1080
G_CALLBACK (session_save), argv[0]);
1081
g_signal_connect (session, "die",
1082
G_CALLBACK (session_die), NULL);
938
1083
printv("going into main loop...\n");
1024
1165
#define SAVE_CONFIG(_type, _name, _cname, _descr) \
1025
1166
buffer = g_strdup_printf (ZCONF_DOMAIN "tuned_channels/%d/" #_cname, i); \
1026
zconf_create_##_type (channel-> _name, _descr, buffer); \
1167
zconf_set_##_type (channel->_name, buffer); \
1168
zconf_set_description (_descr, buffer); \
1027
1169
g_free (buffer);
1029
1171
SAVE_CONFIG (string, name, name, "Station name");
1031
1173
buffer = g_strdup_printf (ZCONF_DOMAIN "tuned_channels/%d/freq", i);
1032
zconf_create_uint (channel->frequ / 1000, "Tuning frequency", buffer);
1174
zconf_set_uint (channel->frequ / 1000, buffer);
1175
zconf_set_description ("Tuning frequency", buffer);
1033
1176
g_free (buffer);
1035
1178
SAVE_CONFIG (z_key, accel, accel, "Accelerator key");
1043
1186
if (channel->num_controls > 0)
1045
1188
buffer = g_strdup_printf (ZCONF_DOMAIN "tuned_channels/%d", i);
1046
zconf_create_controls (channel->controls, channel->num_controls, buffer);
1189
zconf_create_controls (channel->controls,
1190
channel->num_controls, buffer);
1047
1191
g_free (buffer);
1050
1194
SAVE_CONFIG (int, caption_pgno, caption_pgno, "Default subtitle page");
1197
SAVE_CONFIG (uint, num_ttx_encodings, num_ttx_encodings,
1198
"Saved Teletext page encodings");
1200
if (channel->num_ttx_encodings > 0)
1202
buffer = g_strdup_printf (ZCONF_DOMAIN "tuned_channels/%d", i);
1203
zconf_create_ttx_encodings (channel->ttx_encodings,
1204
channel->num_ttx_encodings, buffer);
1237
1385
while (zconf_get_nth (i, &buffer, ZCONF_DOMAIN "tuned_channels") != NULL)
1239
CLEAR (new_channel);
1241
g_assert (strlen (buffer) > 0);
1243
if (buffer[strlen (buffer) - 1] == '/')
1244
buffer[strlen (buffer) - 1] = 0;
1387
tveng_tuned_channel *tc;
1391
tc = tveng_tuned_channel_new (/* copy of */ NULL);
1393
len = strlen (buffer);
1394
while (len > 0 && '/' == buffer[len - 1])
1246
1397
/* Get all the items from here */
1248
1399
#define LOAD_CONFIG(_type, _name, _cname) \
1249
1400
buffer2 = g_strconcat (buffer, "/" #_cname, NULL); \
1250
zconf_get_##_type (&new_channel. _name, buffer2); \
1401
zconf_get_##_type (&tc->_name, buffer2); \
1251
1402
g_free (buffer2);
1253
1404
LOAD_CONFIG (string, name, name);
1254
1405
LOAD_CONFIG (string, rf_name, real_name);
1255
LOAD_CONFIG (int, frequ, freq);
1256
new_channel.frequ *= 1000;
1406
LOAD_CONFIG (uint, frequ, freq);
1407
tc->frequ *= 1000 /* Hz */;
1257
1408
LOAD_CONFIG (z_key, accel, accel);
1258
1409
LOAD_CONFIG (string, rf_table, country);
1259
LOAD_CONFIG (int, input, input);
1260
LOAD_CONFIG (int, standard, standard);
1261
LOAD_CONFIG (int, num_controls, num_controls);
1263
new_channel.controls = zconf_get_controls (new_channel.num_controls,
1266
LOAD_CONFIG (int, caption_pgno, caption_pgno);
1268
tveng_tuned_channel_insert (&global_channel_list,
1269
tveng_tuned_channel_new (&new_channel),
1272
/* Free the previously allocated mem */
1273
g_free (new_channel.name);
1274
g_free (new_channel.rf_name);
1275
g_free (new_channel.rf_table);
1276
g_free (new_channel.controls);
1410
LOAD_CONFIG (uint, input, input);
1411
LOAD_CONFIG (uint, standard, standard);
1412
LOAD_CONFIG (int, caption_pgno, caption_pgno);
1414
/* Error ignored. */
1415
zconf_get_controls (tc, buffer);
1418
/* Error ignored. */
1419
zconf_get_ttx_encodings (tc, buffer);
1422
tveng_tuned_channel_insert (&global_channel_list, tc,
1423
/* position */ G_MAXINT);
1278
1425
g_free (buffer);