|
From: <ren...@us...> - 2007-10-25 21:08:18
|
Revision: 880
http://gmyth.svn.sourceforge.net/gmyth/?rev=880&view=rev
Author: renatofilho
Date: 2007-10-25 14:08:12 -0700 (Thu, 25 Oct 2007)
Log Message:
-----------
fixed connection bug
Modified Paths:
--------------
trunk/gmyth-dbus/src/gmyth-dbus-server.c
Modified: trunk/gmyth-dbus/src/gmyth-dbus-server.c
===================================================================
--- trunk/gmyth-dbus/src/gmyth-dbus-server.c 2007-10-25 19:36:19 UTC (rev 879)
+++ trunk/gmyth-dbus/src/gmyth-dbus-server.c 2007-10-25 21:08:12 UTC (rev 880)
@@ -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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|