diff -r f580fba841bf -r db0d117be7d5 gmyth-dbus/src/gmyth-dbus-server.c --- a/gmyth-dbus/src/gmyth-dbus-server.c Thu Oct 25 20:36:19 2007 +0100 +++ b/gmyth-dbus/src/gmyth-dbus-server.c Fri Oct 26 22:09:47 2007 +0100 @@ -40,6 +40,7 @@ struct _GMythDbusServerPrivate { GMythBackendInfo *myth_backend; + gboolean connected; GMythEPG *myth_epg; GMythScheduler *myth_scheduler; }; @@ -172,6 +173,9 @@ GMythDbusServerPrivate *priv; priv = GMYTH_DBUS_SERVER_GET_PRIVATE (server); + if (!priv->connected) + return FALSE; + if (!priv->myth_epg) { priv->myth_epg = gmyth_epg_new(); @@ -192,6 +196,9 @@ GMythDbusServerPrivate *priv; priv = GMYTH_DBUS_SERVER_GET_PRIVATE (server); + if (!priv->connected) + return FALSE; + if (!priv->myth_scheduler) { priv->myth_scheduler = gmyth_scheduler_new (); @@ -216,6 +223,7 @@ gboolean *result, GError **error) { + GMythSocket *s; GMythDbusServerPrivate *priv; g_debug ("%s:%d", __FUNCTION__, __LINE__); @@ -230,8 +238,23 @@ password, MYTH_DEFAULT_DB, port); - *result = TRUE; - return TRUE; + + s = gmyth_backend_info_get_connected_socket (priv->myth_backend); + if (s) + { + g_object_unref (s); + *result = TRUE; + } + else + { + g_debug ("FAIL TO CONNECT"); + g_object_unref (priv->myth_backend); + priv->myth_backend = NULL; + *result = FALSE; + } + + priv->connected = *result; + return *result; } static gboolean @@ -591,7 +614,7 @@ g_debug ("%s:%d", __FUNCTION__, __LINE__); priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); - g_return_val_if_fail (priv->myth_backend, FALSE); + g_return_val_if_fail (priv->myth_backend != NULL, FALSE); if (!gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj))) return FALSE;