# HG changeset patch # User melunko # Date 1202412982 0 # Node ID b200d61981916a9a440bef1c1b845e391ba9b8ce # Parent da7ce603d47f80f5021a6ea0617253fd365be2cd [svn r921] Added gmyth_dbus_server_check_db_connection() function diff -r da7ce603d47f -r b200d6198191 gmyth-dbus/src/gmyth-dbus-server.c --- a/gmyth-dbus/src/gmyth-dbus-server.c Mon Feb 04 18:23:49 2008 +0000 +++ b/gmyth-dbus/src/gmyth-dbus-server.c Thu Feb 07 19:36:22 2008 +0000 @@ -86,6 +86,13 @@ const gchar *user, const gchar *password, GError **error); +static gboolean gmyth_dbus_server_check_db_connection (GObject *self, + const gchar *host, + gint port, + const gchar *user, + const gchar *password, + GError **error); + static gboolean gmyth_dbus_server_get_channel_list (GObject *obj, GPtrArray **channels, GError **error); @@ -1282,3 +1289,33 @@ return FALSE; } +static gboolean +gmyth_dbus_server_check_db_connection (GObject *obj, + const gchar *host, + gint port, + const gchar *user, + const gchar *password, + GError **error) +{ + GMythQuery *query = gmyth_query_new (); + GMythBackendInfo *binfo; + gboolean ret; + + gmyth_debug (""); + + binfo = gmyth_backend_info_new_full (host, user, password, MYTH_DEFAULT_DB, port); + + ret = gmyth_query_connect_with_timeout (query, binfo, 2 /*seconds*/); + gmyth_query_disconnect (query); + + g_object_unref (query); + g_object_unref (binfo); + + if (!ret) { + g_set_error (error, GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_CONNECTION, + _("Fail to connect with backend")); + } + + return ret; +} + diff -r da7ce603d47f -r b200d6198191 gmyth-dbus/src/gmyth-dbus-server.xml --- a/gmyth-dbus/src/gmyth-dbus-server.xml Mon Feb 04 18:23:49 2008 +0000 +++ b/gmyth-dbus/src/gmyth-dbus-server.xml Thu Feb 07 19:36:22 2008 +0000 @@ -11,6 +11,13 @@ + + + + + + +