[svn r885] fixed bug on connect function trunk
authorrenatofilho
Tue Oct 30 14:08:04 2007 +0000 (2007-10-30)
branchtrunk
changeset 87916c33370755e
parent 878 016b3410871d
child 880 22df7edb6e37
[svn r885] fixed bug on connect function
gmyth-dbus/src/gmyth-dbus-server.c
     1.1 --- a/gmyth-dbus/src/gmyth-dbus-server.c	Mon Oct 29 20:13:33 2007 +0000
     1.2 +++ b/gmyth-dbus/src/gmyth-dbus-server.c	Tue Oct 30 14:08:04 2007 +0000
     1.3 @@ -81,7 +81,6 @@
     1.4                                                       guint port,
     1.5                                                       const gchar *user,
     1.6                                                       const gchar *password,
     1.7 -                                                     gboolean *result,
     1.8                                                       GError **error);
     1.9  static gboolean gmyth_dbus_server_get_channel_list  (GObject *obj,
    1.10                                                       GPtrArray **channels,
    1.11 @@ -234,6 +233,7 @@
    1.12                           _("Fail to connect with EPG"));
    1.13  
    1.14              return FALSE;
    1.15 +
    1.16          }
    1.17      }
    1.18  
    1.19 @@ -284,7 +284,6 @@
    1.20                              guint port,
    1.21                              const gchar *user,
    1.22                              const gchar *password,
    1.23 -                            gboolean *result,
    1.24                              GError **error)
    1.25  {
    1.26      GMythSocket *s;
    1.27 @@ -296,7 +295,7 @@
    1.28  
    1.29      if (priv->connected)
    1.30      {
    1.31 -        gmyth_dbus_server_internal_disconnect (obj, error);
    1.32 +        gmyth_dbus_server_internal_disconnect (obj, NULL);
    1.33      }
    1.34  
    1.35      priv->myth_backend = gmyth_backend_info_new_full (host,
    1.36 @@ -308,14 +307,14 @@
    1.37      s = gmyth_backend_info_get_connected_socket (priv->myth_backend);
    1.38      if (s)
    1.39      {
    1.40 +        priv->connected = TRUE;
    1.41          g_object_unref (s);
    1.42 -        *result = TRUE;
    1.43      }
    1.44      else
    1.45      {
    1.46 +        priv->connected = FALSE;
    1.47          g_object_unref (priv->myth_backend);
    1.48          priv->myth_backend = NULL;
    1.49 -        *result = FALSE;
    1.50  
    1.51          g_set_error (error,
    1.52                       GMYTH_DBUS_ERROR,
    1.53 @@ -323,8 +322,7 @@
    1.54                       _("Fail to connect with backend"));
    1.55      }
    1.56  
    1.57 -    priv->connected = *result;
    1.58 -    return *result;
    1.59 +    return priv->connected;
    1.60  }
    1.61  
    1.62  static gboolean
    1.63 @@ -349,9 +347,14 @@
    1.64  gmyth_dbus_server_disconnect (GObject *obj,
    1.65                                GError **error)
    1.66  {
    1.67 +    GMythDbusServerPrivate *priv;
    1.68  
    1.69 -    gmyth_dbus_server_internal_disconnect (obj, error);
    1.70 -    g_signal_emit (obj, signals[DISCONNECTED], 0);
    1.71 +    priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
    1.72 +    if (priv->connected)
    1.73 +    {
    1.74 +        gmyth_dbus_server_internal_disconnect (obj, error);
    1.75 +        g_signal_emit (obj, signals[DISCONNECTED], 0);
    1.76 +    }
    1.77  
    1.78      return TRUE;
    1.79  }
    1.80 @@ -384,6 +387,8 @@
    1.81          g_object_unref (priv->myth_scheduler);
    1.82          priv->myth_scheduler = NULL;
    1.83      }
    1.84 +
    1.85 +    priv->connected = FALSE;
    1.86  }
    1.87  
    1.88  static gboolean
    1.89 @@ -433,7 +438,7 @@
    1.90                       GMYTH_DBUS_ERROR,
    1.91                       GMYTH_DBUS_ERROR_MYTHTV,
    1.92                       _("Fail to get MythTv details"));
    1.93 -    }
    1.94 +}
    1.95  
    1.96      g_object_unref (socket);
    1.97