# HG changeset patch
# User melunko
# Date 1202428983 0
# Node ID c0f13b16964fd5d4c85ef3f5ff26957953c947d8
# Parent b200d61981916a9a440bef1c1b845e391ba9b8ce
[svn r922] Added method to check mythtv backend connection
diff -r b200d6198191 -r c0f13b16964f gmyth-dbus/configure.ac
--- a/gmyth-dbus/configure.ac Thu Feb 07 19:36:22 2008 +0000
+++ b/gmyth-dbus/configure.ac Fri Feb 08 00:03:03 2008 +0000
@@ -67,7 +67,7 @@
PKG_CHECK_MODULES(GMYTH, gmyth >= 0.7, HAVE_GMYTH=yes, HAVE_GMYTH=no)
if test "x$HAVE_GMYTH" = "xno"; then
- AC_MSG_ERROR(you need libgmyth-dev installed)
+ AC_MSG_ERROR(you need libgmyth-dev >= 0.7 installed)
fi
AC_SUBST(GMYTH_CFLAGS)
AC_SUBST(GMYTH_LIBS)
diff -r b200d6198191 -r c0f13b16964f gmyth-dbus/src/gmyth-dbus-server.c
--- a/gmyth-dbus/src/gmyth-dbus-server.c Thu Feb 07 19:36:22 2008 +0000
+++ b/gmyth-dbus/src/gmyth-dbus-server.c Fri Feb 08 00:03:03 2008 +0000
@@ -92,7 +92,11 @@
const gchar *user,
const gchar *password,
GError **error);
-
+static gboolean
+gmyth_dbus_server_check_server_connection (GObject *obj,
+ const gchar *host,
+ gint port,
+ GError **error);
static gboolean gmyth_dbus_server_get_channel_list (GObject *obj,
GPtrArray **channels,
GError **error);
@@ -1313,6 +1317,32 @@
if (!ret) {
g_set_error (error, GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_CONNECTION,
+ _("Fail to connect with backend database"));
+ }
+
+ return ret;
+}
+
+static gboolean
+gmyth_dbus_server_check_server_connection (GObject *obj,
+ const gchar *host,
+ gint port,
+ GError **error)
+{
+ GMythSocket *msocket = gmyth_socket_new ();
+ gboolean ret;
+
+ gmyth_debug ("");
+
+ g_debug ("Checking server connection");
+ ret = gmyth_socket_connect_with_timeout (msocket, host, port, 2);
+ g_debug ("Return %s", ret ? "ok" : "bad");
+ gmyth_socket_close_connection (msocket);
+
+ g_object_unref (msocket);
+
+ if (!ret) {
+ g_set_error (error, GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_CONNECTION,
_("Fail to connect with backend"));
}
diff -r b200d6198191 -r c0f13b16964f gmyth-dbus/src/gmyth-dbus-server.xml
--- a/gmyth-dbus/src/gmyth-dbus-server.xml Thu Feb 07 19:36:22 2008 +0000
+++ b/gmyth-dbus/src/gmyth-dbus-server.xml Fri Feb 08 00:03:03 2008 +0000
@@ -18,6 +18,11 @@
+
+
+
+
+