# HG changeset patch # User renatofilho # Date 1193753284 0 # Node ID 16c33370755eb85a14b6b30f68f2aedaa3c117fa # Parent 016b3410871d03970d8387472c01cbe23260ea6a [svn r885] fixed bug on connect function diff -r 016b3410871d -r 16c33370755e gmyth-dbus/src/gmyth-dbus-server.c --- a/gmyth-dbus/src/gmyth-dbus-server.c Mon Oct 29 20:13:33 2007 +0000 +++ b/gmyth-dbus/src/gmyth-dbus-server.c Tue Oct 30 14:08:04 2007 +0000 @@ -81,7 +81,6 @@ guint port, const gchar *user, const gchar *password, - gboolean *result, GError **error); static gboolean gmyth_dbus_server_get_channel_list (GObject *obj, GPtrArray **channels, @@ -234,6 +233,7 @@ _("Fail to connect with EPG")); return FALSE; + } } @@ -284,7 +284,6 @@ guint port, const gchar *user, const gchar *password, - gboolean *result, GError **error) { GMythSocket *s; @@ -296,7 +295,7 @@ if (priv->connected) { - gmyth_dbus_server_internal_disconnect (obj, error); + gmyth_dbus_server_internal_disconnect (obj, NULL); } priv->myth_backend = gmyth_backend_info_new_full (host, @@ -308,14 +307,14 @@ s = gmyth_backend_info_get_connected_socket (priv->myth_backend); if (s) { + priv->connected = TRUE; g_object_unref (s); - *result = TRUE; } else { + priv->connected = FALSE; g_object_unref (priv->myth_backend); priv->myth_backend = NULL; - *result = FALSE; g_set_error (error, GMYTH_DBUS_ERROR, @@ -323,8 +322,7 @@ _("Fail to connect with backend")); } - priv->connected = *result; - return *result; + return priv->connected; } static gboolean @@ -349,9 +347,14 @@ gmyth_dbus_server_disconnect (GObject *obj, GError **error) { + GMythDbusServerPrivate *priv; - gmyth_dbus_server_internal_disconnect (obj, error); - g_signal_emit (obj, signals[DISCONNECTED], 0); + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj); + if (priv->connected) + { + gmyth_dbus_server_internal_disconnect (obj, error); + g_signal_emit (obj, signals[DISCONNECTED], 0); + } return TRUE; } @@ -384,6 +387,8 @@ g_object_unref (priv->myth_scheduler); priv->myth_scheduler = NULL; } + + priv->connected = FALSE; } static gboolean @@ -433,7 +438,7 @@ GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_MYTHTV, _("Fail to get MythTv details")); - } +} g_object_unref (socket);