# HG changeset patch
# User morphbr
# Date 1183361638 -3600
# Node ID f1da4fbe667ef8ddab6ab0ecfbc830cc436b9aee
# Parent  57f3de326cd8c29096e4596bec04ba9b1e244280
[svn r772] * Corrected identation;
	* Corrected connect with timeout while retrieving channel_list

diff -r 57f3de326cd8 -r f1da4fbe667e gmyth/src/gmyth_epg.c
--- a/gmyth/src/gmyth_epg.c	Sat Jun 30 15:05:50 2007 +0100
+++ b/gmyth/src/gmyth_epg.c	Mon Jul 02 08:33:58 2007 +0100
@@ -39,6 +39,8 @@
 #include "gmyth_file_transfer.h"
 #include "gmyth_debug.h"
 
+#define CONNECT_TIMEOUT 4
+
 static void     gmyth_epg_class_init(GMythEPGClass * klass);
 static void     gmyth_epg_init(GMythEPG * object);
 
@@ -96,7 +98,7 @@
 
 /** Connects to the Mysql database in the backend. The backend address
  * is loaded from the GMythSettings instance.
- * 
+ *
  * @param gmyth_epg the GMythEPG instance to be connected.
  * @return true if connection was success, false if failed.
  */
@@ -110,7 +112,8 @@
         gmyth_epg->sqlquery = gmyth_query_new();
     }
 
-    if (!gmyth_query_connect(gmyth_epg->sqlquery, backend_info)) {
+    if (!gmyth_query_connect_with_timeout(gmyth_epg->sqlquery,
+                                          backend_info, CONNECT_TIMEOUT)) {
         gmyth_debug("[%s] Error while connecting to db", __FUNCTION__);
         return FALSE;
     }
@@ -122,7 +125,7 @@
 }
 
 /** Disconnects from the Mysql database in the backend.
- * 
+ *
  * @param gmyth_epg the GMythEPG instance to be disconnected
  * @return true if disconnection was success, false if failed.
  */
@@ -387,7 +390,7 @@
                            GMythChannelInfo * channel_info, guint8 ** data,
                            guint * length)
 {
-    gboolean        res = FALSE;
+    gboolean res = FALSE;
 
     g_return_val_if_fail(gmyth_epg != NULL, FALSE);
     g_return_val_if_fail(channel_info != NULL, FALSE);
@@ -395,9 +398,10 @@
     if (gmyth_epg_channel_has_icon(gmyth_epg, channel_info)) {
         GMythFileTransfer *transfer =
             gmyth_file_transfer_new(gmyth_epg->backend_info);
+
         GMythFileReadResult gmyth_res;
-        GByteArray     *icon_data;
-        guint64         icon_length = 0;
+        GByteArray *icon_data;
+        guint64 icon_length = 0;
 
         res = gmyth_file_transfer_open(transfer,
                                        channel_info->channel_icon->str);
diff -r 57f3de326cd8 -r f1da4fbe667e gmyth/src/gmyth_query.c
--- a/gmyth/src/gmyth_query.c	Sat Jun 30 15:05:50 2007 +0100
+++ b/gmyth/src/gmyth_query.c	Mon Jul 02 08:33:58 2007 +0100
@@ -95,7 +95,7 @@
 }
 
 /** Creates a new instance of GMythQuery.
- * 
+ *
  * @return a new instance of GMythQuery.
  */
 GMythQuery     *
@@ -114,14 +114,13 @@
 {
     assert(gmyth_query);
 
-    if (gmyth_query->conn == NULL) {
+    if (gmyth_query->conn == NULL)
         gmyth_query->conn = mysql_init(NULL);
-    }
 
     if (timeout != 0) {
-        /*
-         * sets connection timeout 
-         */
+      /*
+       * sets connection timeout
+       */
         mysql_options(gmyth_query->conn, MYSQL_OPT_CONNECT_TIMEOUT,
                       (gchar *) & timeout);
     }
@@ -131,7 +130,7 @@
 
 /** Connects to the Mysql database in the backend. The backend address
  * is loaded from the GMythBackendInfo instance.
- * 
+ *
  * @param gmyth_query the GMythEPG instance to be connected.
  * @return true if connection was success, false if failed.
  */
@@ -156,7 +155,7 @@
     }
 
     /*
-     * connect to server 
+     * connect to server
      */
     if (mysql_real_connect(gmyth_query->conn,
                            gmyth_query->backend_info->hostname,
@@ -229,7 +228,7 @@
  * @param stmt_str the query text.
  * @return the MYSQL_RES result pointer or NULL if any error happens.
  */
-MYSQL_RES      *
+MYSQL_RES*
 gmyth_query_process_statement(GMythQuery * gmyth_query, char *stmt_str)
 {
     assert(gmyth_query);
@@ -239,22 +238,18 @@
     if (gmyth_query == NULL)
         return NULL;
 
-    /*
-     * the statement failed 
-     */
+    //the statement failed
     if (mysql_query(gmyth_query->conn, stmt_str) != 0) {
         gmyth_query_print_error(gmyth_query->conn,
                                 "Could not execute statement");
         return NULL;
     }
 
-    /*
-     * the statement succeeded; determine whether it returned data 
-     */
+    //the statement succeeded; determine whether it returned data
     return mysql_store_result(gmyth_query->conn);
 }
 
-MYSQL_RES      *
+MYSQL_RES*
 gmyth_query_process_statement_with_increment(GMythQuery * gmyth_query,
                                              char *stmt_str, gulong * id)
 {
@@ -266,7 +261,7 @@
         return NULL;
 
     /*
-     * the statement failed 
+     * the statement failed
      */
     if (mysql_query(gmyth_query->conn, stmt_str) != 0) {
         gmyth_query_print_error(gmyth_query->conn,
diff -r 57f3de326cd8 -r f1da4fbe667e gmyth/src/gmyth_scheduler.c
--- a/gmyth/src/gmyth_scheduler.c	Sat Jun 30 15:05:50 2007 +0100
+++ b/gmyth/src/gmyth_scheduler.c	Mon Jul 02 08:33:58 2007 +0100
@@ -152,7 +152,7 @@
 
 /** Connects to the Mysql database in the backend. The backend address
  * is loaded from the GMythSettings instance.
- * 
+ *
  * @param scheduler the GMythScheduler instance to be connected.
  * @return true if connection was success, false if failed.
  */
@@ -185,7 +185,7 @@
 }
 
 /** Disconnects from the Mysql database in the backend.
- * 
+ *
  * @param scheduler the GMythScheduler instance to be disconnected
  * @return true if disconnection was success, false if failed.
  */
diff -r 57f3de326cd8 -r f1da4fbe667e gmyth/tests/gmyth_test_http.c
--- a/gmyth/tests/gmyth_test_http.c	Sat Jun 30 15:05:50 2007 +0100
+++ b/gmyth/tests/gmyth_test_http.c	Mon Jul 02 08:33:58 2007 +0100
@@ -13,7 +13,7 @@
 
     backend_info = gmyth_backend_info_new();
 
-    gmyth_backend_info_set_hostname(backend_info, "192.168.3.165");
+    gmyth_backend_info_set_hostname(backend_info, "192.168.1.118");
     gmyth_backend_info_set_port(backend_info, 6543);
     gmyth_backend_info_set_status_port(backend_info, 6544);
 
@@ -32,13 +32,13 @@
      * 
      * if ( NULL == epg.channelList || g_slist_length( epg.channelList )
      * <= 0 ) printf( "Channel list is empty!!!" );
-     * 
-     * GMythRecorded recorded; recorded =
-     * gmyth_http_retrieve_recorded(backend_info);
-     * 
-     * GMythRecorded_Program* program = recorded.programList->data; 
-     */
-    GMythRecProfile *profile;
+     */ 
+    GMythRecorded recorded; 
+    recorded = gmyth_http_retrieve_recorded(backend_info);
+    
+    GMythRecorded_Program* program = recorded.programList->data; 
+    
+    /*GMythRecProfile *profile;
 
     GSList         *profiles =
         gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
@@ -66,7 +66,7 @@
     gint            ret =
         gmyth_http_retrieve_job_status(backend_info, 1000, start);
     printf("Status: %d\n\n", ret);
-
+    */
     // if ( profile != NULL )
     // g_object_unref( profile );