~ubuntu-branches/ubuntu/karmic/zapping/karmic

« back to all changes in this revision

Viewing changes to src/main.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Luberda
  • Date: 2008-02-14 12:56:23 UTC
  • mfrom: (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20080214125623-975n25ve2dat7jen
Tags: 0.10~cvs6-2
05_ftbfs_powerpc_libtv.patch: Try to fix FTBFS on powerpc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
 
63
63
Zapping *               zapping;
64
64
 
 
65
static GnomeClient *    session;
65
66
 
66
67
/*** END OF GLOBAL STUFF ***/
67
68
 
78
79
                                         GdkEventKey    *event,
79
80
                                         gpointer       *user_data)
80
81
{
81
 
  return on_user_key_press (widget, event, user_data)
 
82
  return on_channel_enter (widget, event, user_data)
 
83
    || on_user_key_press (widget, event, user_data)
82
84
    || on_picture_size_key_press (widget, event, user_data)
83
85
    || on_channel_key_press (widget, event, user_data);
84
86
}
89
91
startup_teletext(void)
90
92
{
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);
 
98
 
 
99
  D();
 
100
 
 
101
  /* XXX still useful for channel names et al. */
 
102
  if (_teletext_view_new || _subtitle_view_new)
93
103
    {
94
 
      /* Make the vbi module open the device */
95
 
      D();
96
 
      zconf_touch("/zapping/options/vbi/enable_vbi");
 
104
      /* Error ignored. */
 
105
      zvbi_start ();
97
106
      D();
98
107
    }
99
 
  else
 
108
#else
 
109
  disable_vbi = TRUE;
 
110
 
 
111
  gtk_action_group_set_visible (zapping->teletext_action_group, FALSE);
 
112
  gtk_action_group_set_visible (zapping->subtitle_action_group, FALSE);
 
113
 
 
114
  printv ("VBI disabled, removing GUI items\n");
 
115
      
 
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");
100
119
#endif
101
 
    {
102
 
      disable_vbi = TRUE;
103
 
      vbi_gui_sensitive(FALSE);
104
 
    }
105
 
}
106
 
 
107
 
/*
108
 
  Called 0.5s after the main window is created, should solve all the
109
 
  problems with geometry restoring.
110
 
 
111
 
  XXX replace by session management
112
 
*/
113
 
static
114
 
gint resize_timeout             ( gpointer ignored  _unused_)
115
 
{
116
 
  gint x, y, w, h; /* Saved geometry */
117
 
 
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");
122
 
 
123
 
  printv("Restoring geometry: <%d,%d> <%d x %d>\n", x, y, w, h);
124
 
 
125
 
  if (w == 0 || h == 0)
126
 
    {
127
 
      gdk_window_resize(GTK_WIDGET (zapping)->window, 320, 200);
128
 
    }
129
 
  else
130
 
    {
131
 
      gdk_window_move_resize(GTK_WIDGET (zapping)->window, x, y, w, h);
132
 
    }
133
 
 
134
 
  return FALSE;
 
120
}
 
121
 
 
122
static gboolean
 
123
session_save                    (GnomeClient *          client,
 
124
                                 gint                   phase,
 
125
                                 GnomeSaveStyle         save_style,
 
126
                                 gboolean               shutting_down,
 
127
                                 GnomeInteractStyle     interact_style,
 
128
                                 gboolean               fast,
 
129
                                 gpointer               user_data)
 
130
{
 
131
  GList *p;
 
132
  gchar **argv;
 
133
  guint argc;
 
134
  gboolean success;
 
135
 
 
136
  phase = phase;
 
137
  save_style = save_style;
 
138
  shutting_down = shutting_down;
 
139
  interact_style = interact_style;
 
140
  fast = fast;
 
141
 
 
142
  argv = g_malloc0 (4 * sizeof (gchar *));
 
143
  argc = 0;
 
144
 
 
145
  argv[argc++] = user_data; /* main() argv[0] */
 
146
 
 
147
  gnome_client_set_clone_command (client, argc, argv);
 
148
  gnome_client_set_restart_command (client, argc, argv);
 
149
 
 
150
  success = TRUE;
 
151
 
 
152
  for (p = g_list_first (plugin_list); p; p = p->next)
 
153
    {
 
154
      struct plugin_info *pi;
 
155
 
 
156
      /* Shutdown while recording etc no good. */ 
 
157
      pi = (struct plugin_info *) p->data;
 
158
      success &= plugin_running (pi);
 
159
    }
 
160
 
 
161
  /* libgnomeui 2.8 bug: ignores return value. */
 
162
  client->save_successfull = success;
 
163
 
 
164
  return success;
 
165
}
 
166
 
 
167
static void
 
168
session_die                     (GnomeClient *          client,
 
169
                                 gpointer               user_data)
 
170
{
 
171
  client = client;
 
172
  user_data = user_data;
 
173
 
 
174
  on_python_command1 (GTK_WIDGET (zapping), "zapping.quit()");
135
175
}
136
176
 
137
177
#include "pixmaps/brightness.h"
181
221
static void
182
222
restore_controls                (void)
183
223
{
184
 
  tveng_tc_control *controls;
185
 
  guint num_controls;
 
224
  tveng_tuned_channel *tc;
186
225
  gboolean start_muted;
187
226
 
188
227
  D();
189
228
 
190
 
  zconf_get_int (&num_controls, ZCONF_DOMAIN "num_controls");
191
 
  controls = zconf_get_controls (num_controls, "/zapping/options/main");
 
229
  tc = tveng_tuned_channel_new (/* copy of */ NULL);
 
230
 
 
231
  /* Error ignored. */
 
232
  zconf_get_controls (tc, "/zapping/options/main");
192
233
 
193
234
  start_muted = zcg_bool (NULL, "start_muted");
194
235
 
197
238
      tveng_tc_control *mute;
198
239
 
199
240
      if ((mute = tveng_tc_control_by_id (zapping->info,
200
 
                                          controls, num_controls,
 
241
                                          tc->controls, tc->num_controls,
201
242
                                          TV_CONTROL_ID_MUTE)))
202
243
        mute->value = 1;
203
244
    }
204
245
 
205
 
  load_control_values (zapping->info, controls, num_controls);
 
246
  load_control_values (zapping->info, tc->controls, tc->num_controls);
 
247
 
 
248
  tveng_tuned_channel_delete (tc);
 
249
  tc = NULL;
206
250
 
207
251
  set_mute (3 /* update */, /* controls */ TRUE, /* osd */ FALSE);
208
252
 
216
260
    zconf_get_sources (zapping->info, start_muted);
217
261
}
218
262
 
 
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))
 
267
 
219
268
static void
220
269
restore_last_capture_mode               (void)
221
270
{
222
 
  /* Start the capture in the last mode */
223
 
 
224
 
  if (disable_overlay)
225
 
    {
226
 
      if (-1 == zmisc_switch_mode (DISPLAY_MODE_WINDOW,
227
 
                                   CAPTURE_MODE_READ,
228
 
                                   zapping->info))
229
 
        ShowBox (_("Capture mode couldn't be started:\n%s"),
230
 
                 GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
231
 
    }
232
 
  else
233
 
    {
234
 
      display_mode dmode;
235
 
      capture_mode cmode;
236
 
 
237
 
      from_old_tveng_capture_mode (&dmode, &cmode,
238
 
                                   (enum old_tveng_capture_mode)
239
 
                                   zcg_int (NULL, "capture_mode"));
240
 
 
241
 
      if (-1 == zmisc_switch_mode (dmode, cmode, zapping->info))
242
 
        {
243
 
          if (CAPTURE_MODE_READ != cmode)
244
 
            {
245
 
              if (0)
246
 
                ShowBox(_("Cannot restore previous mode, will try capture mode:\n%s"),
247
 
                        GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
248
 
 
249
 
              if (-1 == zmisc_switch_mode (DISPLAY_MODE_WINDOW,
250
 
                                           CAPTURE_MODE_READ, zapping->info))
251
 
                {
252
 
                  if (0)
253
 
                    ShowBox(_("Capture mode couldn't be started either:\n%s"),
254
 
                            GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
255
 
                  else
256
 
                    ShowBox(_("Cannot restore previous mode:\n%s"),
257
 
                            GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
258
 
                }
259
 
            }
260
 
          else
261
 
            {
262
 
              ShowBox (_("Capture mode couldn't be started:\n%s"),
263
 
                       GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
264
 
            }
265
 
        }
266
 
      else
267
 
        {
268
 
          last_dmode = DISPLAY_MODE_WINDOW;
269
 
          last_cmode = CAPTURE_MODE_OVERLAY;
270
 
        }
271
 
    }
 
271
  gint cap_mode;
 
272
  display_mode dmode;
 
273
  capture_mode cmode;
 
274
  gchar *errstr;
 
275
 
 
276
  cap_mode = zcg_int (NULL, "capture_mode");
 
277
  from_old_tveng_capture_mode (&dmode, &cmode,
 
278
                               (enum old_tveng_capture_mode) cap_mode);
 
279
 
 
280
  errstr = NULL;
 
281
 
 
282
  if (CAPTURE_MODE_NONE == cmode)
 
283
    cmode = CAPTURE_MODE_OVERLAY;
 
284
 
 
285
  if (!DEVICE_SUPPORTS_CAPTURE (zapping->info))
 
286
    {
 
287
      GtkAction *action;
 
288
 
 
289
      printv("Device not capture capable, removing GUI items\n");
 
290
      action = gtk_action_group_get_action (zapping->generic_action_group,
 
291
                                            "Capture");
 
292
      z_action_set_sensitive (action, FALSE);
 
293
 
 
294
      if (CAPTURE_MODE_READ == cmode)
 
295
        cmode = CAPTURE_MODE_OVERLAY;
 
296
    }
 
297
 
 
298
  if (disable_overlay || !DEVICE_SUPPORTS_OVERLAY (zapping->info))
 
299
    {
 
300
      GtkAction *action;
 
301
 
 
302
      printv("Device not overlay capable, removing GUI items\n");
 
303
      action = gtk_action_group_get_action (zapping->generic_action_group,
 
304
                                            "Overlay");
 
305
      z_action_set_sensitive (action, FALSE);
 
306
 
 
307
      if (CAPTURE_MODE_OVERLAY == cmode)
 
308
        {
 
309
          if (!DEVICE_SUPPORTS_CAPTURE (zapping->info))
 
310
            goto failed2;
 
311
 
 
312
          cmode = CAPTURE_MODE_READ;
 
313
        }
 
314
    }
 
315
 
 
316
  if (0 == zmisc_switch_mode (dmode, cmode, zapping->info,
 
317
                              /* warnings */ FALSE))
 
318
    goto success;
 
319
 
 
320
  errstr = g_strdup (tv_get_errstr (zapping->info));
 
321
 
 
322
  dmode = DISPLAY_MODE_WINDOW;
 
323
 
 
324
  if (CAPTURE_MODE_READ == cmode)
 
325
    {
 
326
      if (disable_overlay || !DEVICE_SUPPORTS_OVERLAY (zapping->info))
 
327
        goto failed;
 
328
 
 
329
      cmode = CAPTURE_MODE_OVERLAY;
 
330
    }
 
331
  else if (CAPTURE_MODE_OVERLAY == cmode)
 
332
    {
 
333
      if (!DEVICE_SUPPORTS_CAPTURE (zapping->info))
 
334
        goto failed;
 
335
 
 
336
      cmode = CAPTURE_MODE_READ;
 
337
 
 
338
      if (0)
 
339
        ShowBox(_("Cannot restore previous mode, will try capture mode:\n%s"),
 
340
                GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
 
341
    }
 
342
 
 
343
  if (0 == zmisc_switch_mode (dmode, cmode, zapping->info,
 
344
                              /* warnings */ FALSE))
 
345
    goto success;
 
346
 
 
347
  if (0)
 
348
    ShowBox(_("Capture mode couldn't be started either:\n%s"),
 
349
            GTK_MESSAGE_ERROR, tv_get_errstr (zapping->info));
 
350
 
 
351
 failed:
 
352
  ShowBox(_("Cannot restore previous mode:\n%s"),
 
353
          GTK_MESSAGE_ERROR, errstr);
 
354
 
 
355
 failed2:
 
356
  last_dmode = DISPLAY_MODE_WINDOW;
 
357
  last_cmode = CAPTURE_MODE_OVERLAY;
 
358
 
 
359
  g_free (errstr);
 
360
  errstr = NULL;
 
361
 
 
362
  return;
 
363
 
 
364
 success:
 
365
  last_dmode = dmode;
 
366
  last_cmode = cmode;
 
367
 
 
368
  g_free (errstr);
 
369
  errstr = NULL;
272
370
}
273
371
 
274
 
 
275
372
extern int zapzilla_main(int argc, char * argv[]);
276
373
 
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)
 
377
 
 
378
int
 
379
MAIN (PACKAGE_VERSION_ID)       (int                    argc,
 
380
                                 char **                argv);
 
381
 
 
382
int
 
383
MAIN (PACKAGE_VERSION_ID)       (int                    argc,
 
384
                                 char **                argv)
278
385
{
279
386
  GList * p;
280
387
  gint x_bpp = -1;
431
538
      NULL
432
539
    },
433
540
    {
 
541
      "esd-out",
 
542
      0,
 
543
      POPT_ARG_NONE,
 
544
      &esd_output,
 
545
      0,
 
546
      "Copy recorded sound to sound daemon",
 
547
      NULL 
 
548
    },
 
549
    {
 
550
      "ivtv-audio",
 
551
      0,
 
552
      POPT_ARG_NONE,
 
553
      &ivtv_audio,
 
554
      0,
 
555
      "Use ivtv audio device",
 
556
      NULL
 
557
    },
 
558
    {
434
559
      "bpp",
435
560
      'b',
436
561
      POPT_ARG_INT,
535
660
                      argc, argv,
536
661
                      GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR,
537
662
                      GNOME_PARAM_POPT_TABLE, options,
 
663
                      GNOME_CLIENT_PARAM_SM_CONNECT, TRUE,
538
664
                      NULL);
539
665
 
540
666
#ifndef HAVE_PROGRAM_INVOCATION_NAME
542
668
  program_invocation_short_name = g_get_prgname();
543
669
#endif
544
670
 
 
671
  session = gnome_master_client ();
 
672
  g_assert (NULL != session);
 
673
 
545
674
  gconf_client = gconf_client_get_default ();
546
675
  g_assert (NULL != gconf_client);
547
676
 
556
685
    }
557
686
 
558
687
  printv("%s\n%s %s, build date: %s\n",
559
 
         "$Id: main.c,v 1.203 2005/06/28 19:14:15 mschimek Exp $",
 
688
         "$Id: main.c,v 1.213 2006/06/09 01:51:00 mschimek Exp $",
560
689
         "Zapping", VERSION, __DATE__);
561
690
 
562
691
  cpu_detection ();
760
889
  D();
761
890
 
762
891
  if (tveng_attach_device(zcg_char(NULL, "video_device"),
763
 
                          None,
 
892
                          /* window */ None,
764
893
                          TVENG_ATTACH_XV,
765
894
                          info) == -1)
766
895
    {
795
924
              tv_set_filename (info, fallback_devices[i]);
796
925
  
797
926
              if (tveng_attach_device(fallback_devices[i],
798
 
                                      None,
 
927
                                      /* window */ None,
799
928
                                      TVENG_ATTACH_XV,
800
929
                                      info) != -1)
801
930
                {
820
949
 device_ok:
821
950
 
822
951
  if (tv_get_controller (info) == TVENG_CONTROLLER_XV)
823
 
    xv_present = TRUE;
 
952
    {
 
953
      xv_present = TRUE;
 
954
    }
824
955
 
825
956
  D();
826
957
  /* mute the device while we are starting up */
840
971
  startup_subtitle();
841
972
  D();
842
973
  zapping = ZAPPING (zapping_new ());
 
974
    {
 
975
      GnomeClientFlags flags;
 
976
 
 
977
      flags = gnome_client_get_flags (session);
 
978
 
 
979
      /* When started by the session manager we automatically get our
 
980
         previous size and position. */
 
981
      if (!(flags & GNOME_CLIENT_RESTARTED))
 
982
        {
 
983
          gint width;
 
984
          gint height;
 
985
 
 
986
          zconf_get_int (&width, "/zapping/internal/callbacks/w");
 
987
          zconf_get_int (&height, "/zapping/internal/callbacks/h");
 
988
 
 
989
          gtk_window_set_default_size (GTK_WINDOW (zapping), width, height);
 
990
          D();
 
991
        }
 
992
    }
843
993
  gtk_widget_show(GTK_WIDGET (zapping));
844
994
  zapping->info = info;
845
995
  D();
885
1035
      GtkAction *action;
886
1036
 
887
1037
      printv("Preview disabled, removing GUI items\n");
888
 
 
889
 
      action = gtk_action_group_get_action (zapping->generic_action_group,
890
 
                                            "Fullscreen");
891
 
      z_action_set_sensitive (action, FALSE);
892
1038
      action = gtk_action_group_get_action (zapping->generic_action_group,
893
1039
                                            "Overlay");
894
1040
      z_action_set_sensitive (action, FALSE);
923
1069
 
924
1070
  if (!command)
925
1071
    {
926
 
      gtk_widget_show(GTK_WIDGET (zapping));
927
1072
      D();
928
1073
      printv("switching to mode %d (%d)\n",
929
1074
             zcg_int (NULL, "capture_mode"), OLD_TVENG_CAPTURE_READ);
930
1075
      D();
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);
935
 
      D();
936
1076
      restore_last_capture_mode ();
937
1077
      D();
 
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");
939
1084
      gtk_main();
940
1085
    }
953
1098
  return 0;
954
1099
}
955
1100
 
 
1101
int main(int argc, char * argv[])
 
1102
{
 
1103
  return MAIN (PACKAGE_VERSION_ID) (argc, argv);
 
1104
}
 
1105
 
956
1106
void shutdown_zapping(void)
957
1107
{
958
1108
  guint i = 0;
964
1114
  if (was_fullscreen)
965
1115
    zcs_int(OLD_TVENG_CAPTURE_PREVIEW, "capture_mode");
966
1116
 
967
 
#ifdef HAVE_LIBZVBI
968
 
  /*
969
 
   * Shuts down the teletext view
970
 
   */
971
 
  /*  printv(" ttxview"); */
972
 
  /*  if (_shutdown_ttxview) */
973
 
  /*    _shutdown_ttxview(); */
974
 
#endif
975
 
 
976
1117
  /* Unloads all plugins, this tells them to save their config too */
977
1118
  printv("plugins");
978
1119
  plugin_unload_plugins(plugin_list);
997
1138
    store_control_values (zapping->info, &controls, &n_controls);
998
1139
    zconf_delete (ZCONF_DOMAIN "num_controls");
999
1140
    zconf_delete ("/zapping/options/main/controls");
1000
 
    zconf_create_uint (n_controls, "Saved controls",
1001
 
                       ZCONF_DOMAIN "num_controls");
 
1141
    zconf_set_uint (n_controls, ZCONF_DOMAIN "num_controls");
 
1142
    zconf_set_description ("Saved controls", ZCONF_DOMAIN "num_controls");
1002
1143
    zconf_create_controls (controls, n_controls, "/zapping/options/main");
1003
1144
  }
1004
1145
 
1023
1164
 
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);
1028
1170
 
1029
1171
      SAVE_CONFIG (string,  name,         name,         "Station name");
1030
1172
 
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);
1034
1177
 
1035
1178
      SAVE_CONFIG (z_key,   accel,        accel,        "Accelerator key");
1043
1186
      if (channel->num_controls > 0)
1044
1187
        {
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);
1048
1192
        }
1049
1193
 
1050
1194
      SAVE_CONFIG (int, caption_pgno, caption_pgno, "Default subtitle page");
1051
1195
 
 
1196
#ifdef HAVE_LIBZVBI
 
1197
      SAVE_CONFIG (uint,    num_ttx_encodings, num_ttx_encodings,
 
1198
                   "Saved Teletext page encodings");
 
1199
 
 
1200
      if (channel->num_ttx_encodings > 0)
 
1201
        {
 
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);
 
1205
          g_free (buffer);
 
1206
        }
 
1207
#endif
 
1208
 
1052
1209
      i++;
1053
1210
    }
1054
1211
 
1161
1318
{
1162
1319
  guint i = 0;
1163
1320
  gchar * buffer = NULL;
1164
 
  gchar * buffer2 = NULL;
1165
 
  tveng_tuned_channel new_channel;
1166
1321
  GList * p;
1167
1322
  D();
1168
1323
  /* Starts the configuration engine */
1174
1329
  D();
1175
1330
  startup_remote ();
1176
1331
  startup_cmd ();
1177
 
#ifdef GNOME2_PORT_COMPLETE
1178
 
  cmd_register ("subtitle_overlay", subtitle_overlay_cmd, 0, NULL);
1179
 
#endif
1180
1332
  startup_properties();
1181
1333
  D();
1182
1334
 
1183
 
  /* Sets defaults for zconf */
1184
 
  zcc_bool(TRUE, "Save and restore zapping geometry (non ICCM compliant)", 
1185
 
           "keep_geometry");
1186
 
 
1187
1335
  zcc_bool(TRUE, "Show tooltips", "show_tooltips");
1188
1336
  zcc_bool(TRUE, "Resize by fixed increments", "fixed_increments");
1189
1337
 
1236
1384
 
1237
1385
  while (zconf_get_nth (i, &buffer, ZCONF_DOMAIN "tuned_channels") != NULL)
1238
1386
    {
1239
 
      CLEAR (new_channel);
1240
 
 
1241
 
      g_assert (strlen (buffer) > 0);
1242
 
 
1243
 
      if (buffer[strlen (buffer) - 1] == '/')
1244
 
        buffer[strlen (buffer) - 1] = 0;
 
1387
      tveng_tuned_channel *tc;
 
1388
      gchar *buffer2;
 
1389
      guint len;
 
1390
 
 
1391
      tc = tveng_tuned_channel_new (/* copy of */ NULL);
 
1392
 
 
1393
      len = strlen (buffer);
 
1394
      while (len > 0 && '/' == buffer[len - 1])
 
1395
        buffer[--len] = 0;
1245
1396
 
1246
1397
      /* Get all the items from here */
1247
1398
 
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);
1252
1403
 
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);
1262
 
 
1263
 
      new_channel.controls = zconf_get_controls (new_channel.num_controls,
1264
 
                                                 buffer);
1265
 
 
1266
 
      LOAD_CONFIG (int, caption_pgno, caption_pgno);
1267
 
 
1268
 
      tveng_tuned_channel_insert (&global_channel_list,
1269
 
                                  tveng_tuned_channel_new (&new_channel),
1270
 
                                  G_MAXINT);
1271
 
 
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);
 
1413
 
 
1414
      /* Error ignored. */
 
1415
      zconf_get_controls (tc, buffer);
 
1416
 
 
1417
#ifdef HAVE_LIBZVBI
 
1418
      /* Error ignored. */
 
1419
      zconf_get_ttx_encodings (tc, buffer);
 
1420
#endif
 
1421
 
 
1422
      tveng_tuned_channel_insert (&global_channel_list, tc,
 
1423
                                  /* position */ G_MAXINT);
1277
1424
 
1278
1425
      g_free (buffer);
 
1426
 
1279
1427
      i++;
1280
1428
    }
1281
1429
 
1323
1471
        _teletext_view_from_widget = plugin_symbol (info, "view_from_widget");
1324
1472
        _teletext_toolbar_new = plugin_symbol (info, "toolbar_new");
1325
1473
      }
 
1474
 
 
1475
    if ((info = plugin_by_name ("subtitle")))
 
1476
      {
 
1477
        _subtitle_view_new = plugin_symbol (info, "view_new");
 
1478
      }
1326
1479
  }
1327
1480
 
1328
1481
#endif