1.1 --- a/gmyth-dbus/src/gmyth-dbus-server.c Thu Oct 25 20:36:19 2007 +0100
1.2 +++ b/gmyth-dbus/src/gmyth-dbus-server.c Fri Oct 26 22:09:47 2007 +0100
1.3 @@ -40,6 +40,7 @@
1.4 struct _GMythDbusServerPrivate
1.5 {
1.6 GMythBackendInfo *myth_backend;
1.7 + gboolean connected;
1.8 GMythEPG *myth_epg;
1.9 GMythScheduler *myth_scheduler;
1.10 };
1.11 @@ -172,6 +173,9 @@
1.12 GMythDbusServerPrivate *priv;
1.13 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (server);
1.14
1.15 + if (!priv->connected)
1.16 + return FALSE;
1.17 +
1.18 if (!priv->myth_epg)
1.19 {
1.20 priv->myth_epg = gmyth_epg_new();
1.21 @@ -192,6 +196,9 @@
1.22 GMythDbusServerPrivate *priv;
1.23 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (server);
1.24
1.25 + if (!priv->connected)
1.26 + return FALSE;
1.27 +
1.28 if (!priv->myth_scheduler)
1.29 {
1.30 priv->myth_scheduler = gmyth_scheduler_new ();
1.31 @@ -216,6 +223,7 @@
1.32 gboolean *result,
1.33 GError **error)
1.34 {
1.35 + GMythSocket *s;
1.36 GMythDbusServerPrivate *priv;
1.37
1.38 g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.39 @@ -230,8 +238,23 @@
1.40 password,
1.41 MYTH_DEFAULT_DB,
1.42 port);
1.43 - *result = TRUE;
1.44 - return TRUE;
1.45 +
1.46 + s = gmyth_backend_info_get_connected_socket (priv->myth_backend);
1.47 + if (s)
1.48 + {
1.49 + g_object_unref (s);
1.50 + *result = TRUE;
1.51 + }
1.52 + else
1.53 + {
1.54 + g_debug ("FAIL TO CONNECT");
1.55 + g_object_unref (priv->myth_backend);
1.56 + priv->myth_backend = NULL;
1.57 + *result = FALSE;
1.58 + }
1.59 +
1.60 + priv->connected = *result;
1.61 + return *result;
1.62 }
1.63
1.64 static gboolean
1.65 @@ -591,7 +614,7 @@
1.66 g_debug ("%s:%d", __FUNCTION__, __LINE__);
1.67 priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
1.68
1.69 - g_return_val_if_fail (priv->myth_backend, FALSE);
1.70 + g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
1.71 if (!gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj)))
1.72 return FALSE;
1.73