1.1 --- a/gmyth-dbus/src/gmyth-dbus-server.c Fri Feb 01 13:38:20 2008 +0000
1.2 +++ b/gmyth-dbus/src/gmyth-dbus-server.c Thu Feb 07 19:36:22 2008 +0000
1.3 @@ -86,6 +86,13 @@
1.4 const gchar *user,
1.5 const gchar *password,
1.6 GError **error);
1.7 +static gboolean gmyth_dbus_server_check_db_connection (GObject *self,
1.8 + const gchar *host,
1.9 + gint port,
1.10 + const gchar *user,
1.11 + const gchar *password,
1.12 + GError **error);
1.13 +
1.14 static gboolean gmyth_dbus_server_get_channel_list (GObject *obj,
1.15 GPtrArray **channels,
1.16 GError **error);
1.17 @@ -1282,3 +1289,33 @@
1.18 return FALSE;
1.19 }
1.20
1.21 +static gboolean
1.22 +gmyth_dbus_server_check_db_connection (GObject *obj,
1.23 + const gchar *host,
1.24 + gint port,
1.25 + const gchar *user,
1.26 + const gchar *password,
1.27 + GError **error)
1.28 +{
1.29 + GMythQuery *query = gmyth_query_new ();
1.30 + GMythBackendInfo *binfo;
1.31 + gboolean ret;
1.32 +
1.33 + gmyth_debug ("");
1.34 +
1.35 + binfo = gmyth_backend_info_new_full (host, user, password, MYTH_DEFAULT_DB, port);
1.36 +
1.37 + ret = gmyth_query_connect_with_timeout (query, binfo, 2 /*seconds*/);
1.38 + gmyth_query_disconnect (query);
1.39 +
1.40 + g_object_unref (query);
1.41 + g_object_unref (binfo);
1.42 +
1.43 + if (!ret) {
1.44 + g_set_error (error, GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_CONNECTION,
1.45 + _("Fail to connect with backend"));
1.46 + }
1.47 +
1.48 + return ret;
1.49 +}
1.50 +