[svn r491] Solve bug with the --enable-debug on configure.ac; reversed changes in the GMythBackendInfo object; procedure to close the Recorder in not mandatory. trunk
authorrosfran
Tue Apr 03 19:39:23 2007 +0100 (2007-04-03)
branchtrunk
changeset 48656b98fd15019
parent 485 00a5cf92ec21
child 487 ab3aa66009de
[svn r491] Solve bug with the --enable-debug on configure.ac; reversed changes in the GMythBackendInfo object; procedure to close the Recorder in not mandatory.
gmyth/configure.ac
gmyth/src/gmyth_backendinfo.c
gmyth/src/gmyth_backendinfo.h
gmyth/src/gmyth_livetv.c
gmyth/src/gmyth_recorder.c
gmyth/src/gmyth_util.c
     1.1 --- a/gmyth/configure.ac	Tue Apr 03 16:43:11 2007 +0100
     1.2 +++ b/gmyth/configure.ac	Tue Apr 03 19:39:23 2007 +0100
     1.3 @@ -78,17 +78,20 @@
     1.4  
     1.5  # Checks required packages
     1.6  
     1.7 -dnl Test if --disable-debug given
     1.8 +dnl Test if --enable-debug given
     1.9  AC_ARG_ENABLE(debug,
    1.10 -        [AC_HELP_STRING([--disable-debug], [disable debugging mode])],
    1.11 -        enable_debug=no,
    1.12 -        enable_debug=yes)
    1.13 +        [AC_HELP_STRING([--enable-debug], [disable debugging mode])],
    1.14 +        enable_debug=yes,
    1.15 +        enable_debug=no)
    1.16  
    1.17 -if test "x$enable_debug" = "xyes"; then
    1.18 +if test "x$enable_debug" = "xyes" ; then
    1.19 +    AC_DEFINE(GMYTH_USE_DEBUG, 1, [Debug enabled!])
    1.20      CFLAGS="$CFLAGS -g -DGMYTH_USE_DEBUG"
    1.21  else
    1.22      CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS"
    1.23 -fi          
    1.24 +fi
    1.25 +
    1.26 +AM_CONDITIONAL(GMYTH_USE_DEBUG, test "x$enable_debug" = "xyes")
    1.27  
    1.28  # Check for pkgconfig
    1.29  AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
     2.1 --- a/gmyth/src/gmyth_backendinfo.c	Tue Apr 03 16:43:11 2007 +0100
     2.2 +++ b/gmyth/src/gmyth_backendinfo.c	Tue Apr 03 19:39:23 2007 +0100
     2.3 @@ -208,7 +208,7 @@
     2.4  }
     2.5  
     2.6  void
     2.7 -gmyth_backend_info_set_port (GMythBackendInfo *backend_info, const gint port )
     2.8 +gmyth_backend_info_set_port (GMythBackendInfo *backend_info, gint port )
     2.9  {
    2.10      g_return_if_fail (backend_info != NULL);
    2.11  
    2.12 @@ -220,7 +220,7 @@
    2.13  }
    2.14  
    2.15  void
    2.16 -gmyth_backend_info_set_status_port (GMythBackendInfo *backend_info, const gint port )
    2.17 +gmyth_backend_info_set_status_port (GMythBackendInfo *backend_info, gint port )
    2.18  {
    2.19      g_return_if_fail (backend_info != NULL);
    2.20  
     3.1 --- a/gmyth/src/gmyth_backendinfo.h	Tue Apr 03 16:43:11 2007 +0100
     3.2 +++ b/gmyth/src/gmyth_backendinfo.h	Tue Apr 03 19:39:23 2007 +0100
     3.3 @@ -97,6 +97,7 @@
     3.4                                                       gint port);
     3.5  void                gmyth_backend_info_set_status_port (GMythBackendInfo *backend_info,
     3.6  							gint port);
     3.7 +
     3.8  const gchar*        gmyth_backend_info_get_hostname (GMythBackendInfo *backend_info);
     3.9  const gchar*        gmyth_backend_info_get_username (GMythBackendInfo *backend_info);
    3.10  const gchar*        gmyth_backend_info_get_password (GMythBackendInfo *backend_info);
     4.1 --- a/gmyth/src/gmyth_livetv.c	Tue Apr 03 16:43:11 2007 +0100
     4.2 +++ b/gmyth/src/gmyth_livetv.c	Tue Apr 03 19:39:23 2007 +0100
     4.3 @@ -103,6 +103,7 @@
     4.4  	}
     4.5  	
     4.6  	if ( livetv->recorder != NULL ) {
     4.7 +        gmyth_recorder_close(livetv->recorder);
     4.8  		g_object_unref (livetv->recorder);
     4.9  		livetv->recorder = NULL;
    4.10  	}
    4.11 @@ -423,7 +424,7 @@
    4.12  		res = FALSE;
    4.13  		goto error;
    4.14  	}
    4.15 -	
    4.16 +    
    4.17  	/* Creates livetv chain handler */
    4.18  	livetv->tvchain = gmyth_tvchain_new();
    4.19  	gmyth_tvchain_initialize ( livetv->tvchain, livetv->backend_info );
     5.1 --- a/gmyth/src/gmyth_recorder.c	Tue Apr 03 16:43:11 2007 +0100
     5.2 +++ b/gmyth/src/gmyth_recorder.c	Tue Apr 03 19:39:23 2007 +0100
     5.3 @@ -72,7 +72,7 @@
     5.4  {
     5.5      GMythRecorder *recorder=  GMYTH_RECORDER(object);
     5.6  
     5.7 -    gmyth_recorder_close(recorder);
     5.8 +    /* gmyth_recorder_close(recorder); */
     5.9  
    5.10      if ( recorder->mutex != NULL) {
    5.11          g_mutex_free(recorder->mutex);
    5.12 @@ -83,10 +83,12 @@
    5.13          g_object_unref(recorder->myth_socket);
    5.14          recorder->myth_socket = NULL;
    5.15      }
    5.16 -
    5.17 -    gmyth_free_program_list (recorder->progs_info_list);
    5.18 -
    5.19 -    g_string_free (recorder->hostname, TRUE);
    5.20 +    
    5.21 +    if ( recorder->progs_info_list != NULL )
    5.22 +        gmyth_free_program_list (recorder->progs_info_list);
    5.23 +    
    5.24 +    if ( recorder->hostname != NULL )
    5.25 +        g_string_free (recorder->hostname, TRUE);
    5.26  
    5.27      G_OBJECT_CLASS (gmyth_recorder_parent_class)->dispose (object);
    5.28  }
    5.29 @@ -611,10 +613,10 @@
    5.30              channel_list = g_list_append( channel_list, g_strdup( channel ) );
    5.31          }
    5.32          
    5.33 -        g_free( channel );
    5.34 -        
    5.35      } /* for - channel list */
    5.36      
    5.37 +    g_free( channel );
    5.38 +    
    5.39      return channel_list;
    5.40      
    5.41  }
     6.1 --- a/gmyth/src/gmyth_util.c	Tue Apr 03 16:43:11 2007 +0100
     6.2 +++ b/gmyth/src/gmyth_util.c	Tue Apr 03 19:39:23 2007 +0100
     6.3 @@ -560,29 +560,39 @@
     6.4  
     6.5      g_return_val_if_fail (backend_info != NULL, FALSE);
     6.6  
     6.7 -    recorder = gmyth_recorder_new ( 0, g_string_new( gmyth_backend_info_get_hostname( backend_info ) ), 
     6.8 +    recorder = gmyth_recorder_new ( 1, g_string_new( gmyth_backend_info_get_hostname( backend_info ) ), 
     6.9              gmyth_backend_info_get_port( backend_info ) );
    6.10      res = gmyth_recorder_setup (recorder);
    6.11  
    6.12      if (res == TRUE) {
    6.13 -        GList* channel_list_strs = gmyth_recorder_get_channel_list( recorder );
    6.14 +        channel_list = gmyth_recorder_get_channel_list( recorder );        
    6.15 +        gmyth_debug( "Yeah, got channel list!!!" );
    6.16 +        /*
    6.17          GList* ch = NULL;
    6.18          GMythChannelInfo* channel_info = NULL;
    6.19          
    6.20 -        for ( ch = channel_list_strs; ch != NULL; ch = g_list_next(ch)  )
    6.21 +        for ( ch = gmyth_recorder_get_channel_list( recorder ); ch != NULL; )
    6.22          {
    6.23 -            channel_info = g_new0(GMythChannelInfo, 1);
    6.24 +            channel_info = g_malloc0(GMythChannelInfo, sizeof(GMythChannelInfo));
    6.25              channel_info->channel_ID = 0;
    6.26              channel_info->channel_num = g_string_new ( g_strdup( (gchar*)ch->data ) );
    6.27              channel_info->channel_name = g_string_new ("");
    6.28              gmyth_debug("Printing channel info... (%s)", channel_info->channel_num->str );
    6.29 -            channel_list = g_list_append( channel_list, channel_info ); 
    6.30 -        } /* for */
    6.31 +            channel_list = g_list_append( channel_list, g_memdup( channel_info, sizeof(GMythChannelInfo) ) );
    6.32 +            
    6.33 +            ch = g_list_next(ch);
    6.34 +            
    6.35 +            if ( channel_info != NULL )
    6.36 +                g_free( channel_info );
    6.37 +        }
    6.38          
    6.39 -        //if ( channel_info != NULL )
    6.40 -        //    g_free( channel_info );   
    6.41 +        */        
    6.42 +        
    6.43  
    6.44      } /* if */
    6.45 +    else {
    6.46 +        gmyth_debug( "No, couldn't get the channel list!!!" );
    6.47 +    }
    6.48      
    6.49      g_object_unref (recorder);
    6.50